Skip to content

Commit 7b6b1de

Browse files
denizzzkathewilsonator
authored andcommitted
suspendThreadImpl() and resumeThreadImpl() moved to posix_impl, TODO solved
1 parent bcfb47e commit 7b6b1de

2 files changed

Lines changed: 22 additions & 26 deletions

File tree

druntime/src/core/thread/osthread.d

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,32 +1087,6 @@ private extern(D) void* getStackBottom() nothrow @nogc
10871087
}
10881088

10891089

1090-
// Returns true on success
1091-
// TODO: move to posix_impl module
1092-
version (Posix)
1093-
package bool suspendThreadImpl(Thread t) @nogc nothrow
1094-
{
1095-
version (Darwin)
1096-
return thread_suspend(t.m_tmach) == KERN_SUCCESS;
1097-
else version (Solaris)
1098-
return thr_suspend(t.m_addr) == 0;
1099-
else
1100-
return pthread_kill(t.m_addr, suspendSignalNumber) == 0;
1101-
}
1102-
1103-
// Returns true on success
1104-
// TODO: move to posix_impl module
1105-
version (Posix)
1106-
package bool resumeThreadImpl(Thread t) @nogc nothrow
1107-
{
1108-
version (Darwin)
1109-
return thread_resume(t.m_tmach) == KERN_SUCCESS;
1110-
else version (Solaris)
1111-
return thr_continue(t.m_addr) == 0;
1112-
else
1113-
return pthread_kill(t.m_addr, resumeSignalNumber) == 0;
1114-
}
1115-
11161090
/**
11171091
* Suspend the specified thread and load stack and register information for
11181092
* use by thread_scanAll. If the supplied thread is the calling thread,

druntime/src/core/thread/posix_impl.d

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,4 +627,26 @@ do
627627
package __gshared int suspendSignalNumber;
628628
package __gshared int resumeSignalNumber;
629629

630+
// Returns true on success
631+
package bool suspendThreadImpl(Thread t) @nogc nothrow
632+
{
633+
version (Darwin)
634+
return thread_suspend(t.m_tmach) == KERN_SUCCESS;
635+
else version (Solaris)
636+
return thr_suspend(t.m_addr) == 0;
637+
else
638+
return pthread_kill(t.m_addr, suspendSignalNumber) == 0;
639+
}
640+
641+
// Returns true on success
642+
package bool resumeThreadImpl(Thread t) @nogc nothrow
643+
{
644+
version (Darwin)
645+
return thread_resume(t.m_tmach) == KERN_SUCCESS;
646+
else version (Solaris)
647+
return thr_continue(t.m_addr) == 0;
648+
else
649+
return pthread_kill(t.m_addr, resumeSignalNumber) == 0;
650+
}
651+
630652
package alias gettid = imported!"core.sys.posix.pthread".pthread_self;

0 commit comments

Comments
 (0)