File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1628,70 +1628,48 @@ extern (C) void thread_suspendAll() nothrow
16281628private extern (D) void resume(ThreadBase _t) nothrow @nogc
16291629{
16301630 Thread t = _t.toThread;
1631+ const sameThread = t.m_addr == gettid();
16311632
1632- version ( Windows )
1633+ if ( ! sameThread )
16331634 {
1634- if ( t.m_addr != GetCurrentThreadId() && ResumeThread( t.m_hndl ) == 0xFFFFFFFF )
1635+ if (! resumeThreadImpl(t) )
16351636 {
1636- if ( ! t.isRunning )
1637+ if (t.isRunning)
1638+ onThreadError( " Unable to resume thread" );
1639+ else
16371640 {
16381641 Thread .remove( t );
16391642 return ;
16401643 }
1641- onThreadError( " Unable to resume thread" );
16421644 }
1645+ }
1646+
1647+ storeStackAndRegInfo(t, sameThread);
1648+ }
16431649
1650+ private void storeStackAndRegInfo (Thread t, const bool sameThread) nothrow @nogc
1651+ {
1652+ version (Windows )
1653+ {
16441654 if ( ! t.m_lock )
16451655 t.m_curr.tstack = t.m_curr.bstack;
16461656 t.m_reg[0 .. $] = 0 ;
16471657 }
16481658 else version (Darwin)
16491659 {
1650- if ( t.m_addr != pthread_self() && thread_resume( t.m_tmach ) != KERN_SUCCESS )
1651- {
1652- if ( ! t.isRunning )
1653- {
1654- Thread .remove( t );
1655- return ;
1656- }
1657- onThreadError( " Unable to resume thread" );
1658- }
1659-
16601660 if ( ! t.m_lock )
16611661 t.m_curr.tstack = t.m_curr.bstack;
16621662 t.m_reg[0 .. $] = 0 ;
16631663 }
16641664 else version (Solaris )
16651665 {
1666- if (t.m_addr != pthread_self() && thr_continue(t.m_addr) != 0 )
1667- {
1668- if (! t.isRunning)
1669- {
1670- Thread .remove(t);
1671- return ;
1672- }
1673- onThreadError(" Unable to resume thread" );
1674- }
1675-
16761666 if (! t.m_lock)
16771667 t.m_curr.tstack = t.m_curr.bstack;
16781668 t.m_reg[0 .. $] = 0 ;
16791669 }
16801670 else version (Posix )
16811671 {
1682- if ( t.m_addr != pthread_self() )
1683- {
1684- if ( pthread_kill( t.m_addr, resumeSignalNumber ) != 0 )
1685- {
1686- if ( ! t.isRunning )
1687- {
1688- Thread .remove( t );
1689- return ;
1690- }
1691- onThreadError( " Unable to resume thread" );
1692- }
1693- }
1694- else if ( ! t.m_lock )
1672+ if (sameThread && ! t.m_lock)
16951673 {
16961674 t.m_curr.tstack = t.m_curr.bstack;
16971675 }
You can’t perform that action at this time.
0 commit comments