rem: void *arg;
context: int main(int argc, char *argv[]){    int             i, code;    Ns_Thread       threads[10];    Ns_Thread       self, dumper;    extern int      nsMemPools;#ifndef USE_SPROC    pthread_t tids[10];    void *arg;#endif    nsThreadMutexMeter = 1;    nsMemPools = 1;    Ns_ThreadSetName("-main-");    /*     * Jump directly to memory test if requested.      */    if (argv[1] != NULL && argv[1][0] == 'm') {	i = atoi(argv[1] + 1);	if (i > 0) {	    nthreads = i;	}	goto mem;    }    Ns_ThreadCreate(DumperThread, NULL, 0, &dumper);    Ns_MutexSetName(&lock, "startlock");    Ns_MutexSetName(&dlock, "dumplock");    Ns_MutexSetName(&mlock, "msglock");    Ns_MutexSetName(&block, "busylock");    nsThreadStackSize = 81920;    Ns_SemaInit(&sema, 3);    Msg("sema initialized to 3");    atexit(AtExit);    Msg("pid = %d", getpid());    Ns_TlsAlloc(&key, TlsLogArg);    for (i = 0; i < 10; ++i) {	Msg("starting work thread %d", i);	Ns_ThreadCreate(WorkThread, (void *) i, 0, &threads[i]);    }    sleep(1);    /* Ns_CondSignal(&cond); */    Ns_SemaPost(&sema, 10);    Msg("sema post 10");    Ns_RWLockWrLock(&rwlock);    Msg("rwlock write locked (main thread)");    sleep(1);    Ns_RWLockUnlock(&rwlock);    Msg("rwlock write unlocked (main thread)");    for (i = 0; i < 10; ++i) {	Msg("waiting for thread %d to exit", i);	Ns_ThreadJoin(&threads[i], (void **) &code);	Msg("thread %d exited - code: %d", i, code);    }#ifndef USE_SPROC    for (i = 0; i < 10; ++i) {	pthread_create(&tids[i], NULL, Pthread, (void *) i);	printf("pthread: create %d = %d\n", i, tids[i]);	Ns_ThreadYield();    }    Ns_ThreadMemStats(stdout);    Ns_MutexLock(&plock);    pgo = 1;    Ns_MutexUnlock(&plock);    Ns_CondBroadcast(&pcond);    for (i = 0; i < 10; ++i) {	pthread_join(tids[i], &arg);	printf("pthread: join %d = %d\n", i, (int) arg);    }#endif    Ns_ThreadSelf(&self);    Ns_MutexLock(&dlock);    dstop = 1;    Ns_CondSignal(&dcond);    Ns_MutexUnlock(&dlock);    Ns_ThreadJoin(&dumper, NULL);    Msg("threads joined");    for (i = 0; i < 10; ++i) {	Ns_ThreadCreate(CheckStackThread, NULL, 8192*(i+1), &threads[i]);    }    for (i = 0; i < 10; ++i) {        Ns_ThreadJoin(&threads[i], &arg);	printf("check stack %d = %d\n", i, (int) arg);    }    Ns_ThreadEnum(DumpThreads, NULL);    Ns_MutexEnum(DumpLocks, NULL);mem:    MemTime(0);    MemTime(1);    Ns_ThreadMemStats(stdout);    return 0;}