[Gc] Re: Re: sigset_t not defined for win32-pthreads
windev92
windev92 at yahoo.fr
Thu Sep 2 04:35:04 PDT 2010
I'm using 7.1, but it is finally a race condition, not a problem per se.
Using GC_CreateThread, we don't have this side effect, thread GC_start function
is called quickly and thread is hence registered.
With pthread, it's not the case(on Win32 at least on my machine)
The code below shows the problem.
pthread_t t;
int code;
if((code = pthread_create(&t, 0, pthreadfn, 0))!= 0)
{
return -1;
}
GC_gcollect();
GC_gcollect() doesn't suspend the thread when called straight after. pthreadfn
should be called first, to make sure its thread is registered.
Do you have a sample code showing how to do this with *pthreads*?
Equivalent of :
hThread = GC_CreateThread(NULL,0, threadFn,&lszThreadParam,0,&dwGenericThread);
WaitForSingleObject(g_startedThreadEvent,INFINITE);
GC_gcollect();
DWORD WINAPI threadFn(LPVOID iValue)
{
SetEvent(g_startedThreadEvent);
}
Thanks
More information about the Gc
mailing list