* thread.cc (pthread::create): Use thread mutex to control synchronization
rather than creating a suspended thread. Wait for "cancellation event" to indicate that started thread has been properly initialized. (pthread::thread_init_wrapper): Use set_tls_self_pointer() to set tid and cygtls. Signal with cancel_event when done.
This commit is contained in:
parent
b96dbd203d
commit
3e78b5d75c
@ -1,6 +1,15 @@
|
|||||||
|
2004-04-12 Christopher Faylor <cgf@alum.bu.edu>
|
||||||
|
|
||||||
|
* thread.cc (pthread::create): Use thread mutex to control
|
||||||
|
synchronization rather than creating a suspended thread. Wait for
|
||||||
|
"cancellation event" to indicate that started thread has been properly
|
||||||
|
initialized.
|
||||||
|
(pthread::thread_init_wrapper): Use set_tls_self_pointer() to set tid
|
||||||
|
and cygtls. Signal with cancel_event when done.
|
||||||
|
|
||||||
2004-04-12 Pierre Humblet <pierre.humblet@ieee.org>
|
2004-04-12 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
* path.cc (path_conv::check): Fix "tail filling" logic.
|
* path.cc (path_conv::check): Fix "tail filling" logic.
|
||||||
|
|
||||||
2004-04-11 Christopher Faylor <cgf@alum.bu.edu>
|
2004-04-11 Christopher Faylor <cgf@alum.bu.edu>
|
||||||
|
|
||||||
@ -571,7 +580,7 @@
|
|||||||
|
|
||||||
2004-03-19 Pierre Humblet <pierre.humblet@ieee.org>
|
2004-03-19 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
* dir.cc (rmdir): Reorganize error handling to reduce indentation.
|
* dir.cc (rmdir): Reorganize error handling to reduce indentation.
|
||||||
|
|
||||||
2004-03-19 Christopher Faylor <cgf@redhat.com>
|
2004-03-19 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
@ -290,9 +290,9 @@ pthread::create (void *(*func) (void *), pthread_attr *newattr,
|
|||||||
function = func;
|
function = func;
|
||||||
arg = threadarg;
|
arg = threadarg;
|
||||||
|
|
||||||
|
mutex.lock ();
|
||||||
win32_obj_id = ::CreateThread (&sec_none_nih, attr.stacksize,
|
win32_obj_id = ::CreateThread (&sec_none_nih, attr.stacksize,
|
||||||
thread_init_wrapper, this, CREATE_SUSPENDED,
|
thread_init_wrapper, this, 0, &thread_id);
|
||||||
&thread_id);
|
|
||||||
|
|
||||||
if (!win32_obj_id)
|
if (!win32_obj_id)
|
||||||
{
|
{
|
||||||
@ -301,9 +301,12 @@ pthread::create (void *(*func) (void *), pthread_attr *newattr,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (WaitForSingleObject (cancel_event, 5000) != WAIT_OBJECT_0)
|
||||||
|
thread_printf ("event never arrived after CreateThread");
|
||||||
|
ResetEvent (cancel_event);
|
||||||
postcreate ();
|
postcreate ();
|
||||||
ResumeThread (win32_obj_id);
|
|
||||||
}
|
}
|
||||||
|
mutex.unlock ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1861,7 +1864,8 @@ DWORD WINAPI
|
|||||||
pthread::thread_init_wrapper (void *arg)
|
pthread::thread_init_wrapper (void *arg)
|
||||||
{
|
{
|
||||||
pthread *thread = (pthread *) arg;
|
pthread *thread = (pthread *) arg;
|
||||||
_my_tls.tid = thread;
|
set_tls_self_pointer (thread);
|
||||||
|
SetEvent (thread->cancel_event);
|
||||||
|
|
||||||
thread->mutex.lock ();
|
thread->mutex.lock ();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user