* cygthread.cc (cygthread::stub): Revert previous change and again subsume
cygthread::stub2. Just return from function now since ExitThread is guaranteed by automatic _threadinfo wrapper. Define as per ThreadProc convention. (cygthread::stub2): Remove. (cygthread::simplestub): Perform similar operations to cygthread::stub. (cygthread::simplestub2): Remove. * cygthread.h (cygthread::stub): Declare as per ThreadProc convention. (cygthread::stub2): Remove declaration. (cygthread::simplestub): Declare as per ThreadProc convention. (cygthread::simplestub2): Remove declaration. * cygtls.h (_threadinfo::call): Define first argument as per ThreadProc convention. (_threadinfo::call2): Ditto. (_tlsbase): Define as char * pointer. (_tlstop): New definition. (_main_tls): Define here. * dcrt0.cc (alloc_stack): Revert previous change which called init_thread since information would be overwritten by fork later anyway. (dll_crt0_1): Use _tlsbase and _tlstop for setting stack bottom, top. * exceptions.cc: Move _main_tls declaration to cygtls.h. (_threadinfo::call): Define first argument as per ThreadProc convention. (_threadinfo::call2): Call ExitThread with thread function return value. (_threadinfo::init_thread): Don't initialize cygtls to zero if input arg is NULL. * fork.cc (fork_child): Reset _main_tls here. Reinitialize parts of _my_tls after copying data from parent. * init.cc (threadfunc_fe): New function. Front-end for all threads created in cygwin processes. (munge_threadfunc): New function. (dll_entry): Call munge_threadfunc to force the call of a thread wrapper. * thread.cc (pthread::thread_init_wrapper): Perform similar operations to cygthread::stub. (pthread::thread_init_wrapper2): Remove. * thread.h (pthread::thread_init_wrapper): Declare as per ThreadProc convention. (pthread::thread_init_wrapper2): Remove declaration. * window.cc (Winmain): Just return from function now since ExitThread is guaranteed by automatic _threadinfo wrapper.
This commit is contained in:
@ -38,7 +38,6 @@ extern void sigdelayed ();
|
||||
|
||||
_threadinfo NO_COPY dummy_thread;
|
||||
_threadinfo NO_COPY *_last_thread = &dummy_thread;
|
||||
extern _threadinfo *_main_tls;
|
||||
|
||||
CRITICAL_SECTION NO_COPY _threadinfo::protect_linked_list;
|
||||
|
||||
@ -150,17 +149,17 @@ _threadinfo::reset_exception ()
|
||||
}
|
||||
|
||||
void
|
||||
_threadinfo::call (void (*func) (void *, void *), void *arg)
|
||||
_threadinfo::call (DWORD (*func) (void *, void *), void *arg)
|
||||
{
|
||||
char buf[CYGTLS_PADSIZE];
|
||||
_my_tls.call2 (func, arg, buf);
|
||||
}
|
||||
|
||||
void
|
||||
_threadinfo::call2 (void (*func) (void *, void *), void *arg, void *buf)
|
||||
_threadinfo::call2 (DWORD (*func) (void *, void *), void *arg, void *buf)
|
||||
{
|
||||
init_thread (buf);
|
||||
func (arg, buf);
|
||||
ExitThread (func (arg, buf));
|
||||
}
|
||||
|
||||
void
|
||||
@ -170,10 +169,13 @@ _threadinfo::init ()
|
||||
}
|
||||
|
||||
void
|
||||
_threadinfo::init_thread (void *)
|
||||
_threadinfo::init_thread (void *x)
|
||||
{
|
||||
memset (this, 0, sizeof (*this));
|
||||
stackptr = stack;
|
||||
if (x)
|
||||
{
|
||||
memset (this, 0, sizeof (*this));
|
||||
stackptr = stack;
|
||||
}
|
||||
|
||||
EnterCriticalSection (&protect_linked_list);
|
||||
prev = _last_thread;
|
||||
|
Reference in New Issue
Block a user