int Ns_BeginThread( Ns_ThreadProc *start_routine, void *arg, Ns_Thread *thread );
Ns_BeginThread starts a new thread running start_routine and passwd arg as its context. If thread is non-null it will be filled with the thread's id. (see Ns_WaitForThread.)
Ns_ThreadCreate is the preferred function to start a thread.
static void ThreadStart(void *arg) { int n; n = (int) arg; Ns_Log(Notice, "%d: %d", Ns_GetThreadId(), n); } /* * ManyThreadWait - Create 10 threads which all log a message * and wait for all of them to exit. */ static void ManyThreadWait(void) { int i; Ns_Thread tids[10]; for (i = 0; i < 10; ++i) { Ns_BeginThread(ThreadStart, (void *) i, &tids[i]); } for (i = 0; i < 10; ++i) { Ns_WaitForThread(&tids[i]); } }