File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1622,70 +1622,48 @@ extern (C) void thread_suspendAll() nothrow
16221622private extern (D) void resume(ThreadBase _t) nothrow @nogc
16231623{
16241624 Thread t = _t.toThread;
1625+ const sameThread = t.m_addr == gettid();
16251626
1626- version ( Windows )
1627+ if ( ! sameThread )
16271628 {
1628- if ( t.m_addr != GetCurrentThreadId() && ResumeThread( t.m_hndl ) == 0xFFFFFFFF )
1629+ if (! resumeThreadImpl(t) )
16291630 {
1630- if ( ! t.isRunning )
1631+ if (t.isRunning)
1632+ onThreadError( " Unable to resume thread" );
1633+ else
16311634 {
16321635 Thread .remove( t );
16331636 return ;
16341637 }
1635- onThreadError( " Unable to resume thread" );
16361638 }
1639+ }
1640+
1641+ storeStackAndRegInfo(t, sameThread);
1642+ }
16371643
1644+ private void storeStackAndRegInfo (Thread t, const bool sameThread) nothrow @nogc
1645+ {
1646+ version (Windows )
1647+ {
16381648 if ( ! t.m_lock )
16391649 t.m_curr.tstack = t.m_curr.bstack;
16401650 t.m_reg[0 .. $] = 0 ;
16411651 }
16421652 else version (Darwin)
16431653 {
1644- if ( t.m_addr != pthread_self() && thread_resume( t.m_tmach ) != KERN_SUCCESS )
1645- {
1646- if ( ! t.isRunning )
1647- {
1648- Thread .remove( t );
1649- return ;
1650- }
1651- onThreadError( " Unable to resume thread" );
1652- }
1653-
16541654 if ( ! t.m_lock )
16551655 t.m_curr.tstack = t.m_curr.bstack;
16561656 t.m_reg[0 .. $] = 0 ;
16571657 }
16581658 else version (Solaris )
16591659 {
1660- if (t.m_addr != pthread_self() && thr_continue(t.m_addr) != 0 )
1661- {
1662- if (! t.isRunning)
1663- {
1664- Thread .remove(t);
1665- return ;
1666- }
1667- onThreadError(" Unable to resume thread" );
1668- }
1669-
16701660 if (! t.m_lock)
16711661 t.m_curr.tstack = t.m_curr.bstack;
16721662 t.m_reg[0 .. $] = 0 ;
16731663 }
16741664 else version (Posix )
16751665 {
1676- if ( t.m_addr != pthread_self() )
1677- {
1678- if ( pthread_kill( t.m_addr, resumeSignalNumber ) != 0 )
1679- {
1680- if ( ! t.isRunning )
1681- {
1682- Thread .remove( t );
1683- return ;
1684- }
1685- onThreadError( " Unable to resume thread" );
1686- }
1687- }
1688- else if ( ! t.m_lock )
1666+ if (sameThread && ! t.m_lock)
16891667 {
16901668 t.m_curr.tstack = t.m_curr.bstack;
16911669 }
You can’t perform that action at this time.
0 commit comments