rem: Ns_Log(Notice, "random: generating %d random seeds...", nseeds); Ns_MasterLock(); Ns_SemaInit(&counterSema, 0); counterRun = 1; Ns_ThreadCreate((Ns_ThreadProc *) CounterThread, NULL, 0, &thr);
add: Ns_CsEnter(&lock); Ns_SemaInit(&sema, 0); fRun = 1; Ns_ThreadCreate(CounterThread, NULL, 0, &thr);
context: Ns_GenSeeds(unsigned long *seedsPtr, int nseeds){    Ns_Thread thr;        Ns_Log(Notice, "random: generating %d random seeds...", nseeds);    Ns_MasterLock();    Ns_SemaInit(&counterSema, 0);    counterRun = 1;    Ns_ThreadCreate((Ns_ThreadProc *) CounterThread, NULL, 0, &thr);    while (nseeds-- > 0) {    	*seedsPtr++ = raw_truerand();    }    counterRun = 0;    Ns_SemaPost(&counterSema, 1);    Ns_MasterUnlock();    Ns_ThreadJoin(&thr, NULL);    Ns_SemaDestroy(&counterSema);    Ns_Log(Notice, "random: seed generation complete");}