Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
add the Thread after errors are handled
Browse files Browse the repository at this point in the history
- would have ended up with a stale Thread entry
- Thread list access is slock synchronized so it makes
  no difference when we add it
  • Loading branch information
MartinNowak committed Jul 10, 2012
1 parent 43525e9 commit 7a731ff
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/core/thread.d
Expand Up @@ -828,18 +828,6 @@ class Thread
// having thread being treated like a daemon thread.
synchronized( slock )
{
// NOTE: when creating threads from inside a DLL, DllMain(THREAD_ATTACH)
// might be called before ResumeThread returns, but the dll
// helper functions need to know whether the thread is created
// from the runtime itself or from another DLL or the application
// to just attach to it
// as a consequence, the new Thread object is added before actual
// creation of the thread. There should be no problem with the GC
// calling thread_suspendAll, because of the slock synchronization
//
// VERIFY: does this actually also apply to other platforms?
add( this );

version( Windows )
{
if( ResumeThread( m_hndl ) == -1 )
Expand All @@ -862,6 +850,18 @@ class Thread
if( m_tmach == m_tmach.init )
throw new ThreadException( "Error creating thread" );
}

// NOTE: when creating threads from inside a DLL, DllMain(THREAD_ATTACH)
// might be called before ResumeThread returns, but the dll
// helper functions need to know whether the thread is created
// from the runtime itself or from another DLL or the application
// to just attach to it
// as a consequence, the new Thread object is added before actual
// creation of the thread. There should be no problem with the GC
// calling thread_suspendAll, because of the slock synchronization
//
// VERIFY: does this actually also apply to other platforms?
add( this );
}
}

Expand Down

0 comments on commit 7a731ff

Please sign in to comment.