I get the same error.
Fix:
The following code works allright on MacOS X 10.6.4 / DMD v2.047:
module fork;
import core.sys.posix.unistd,
core.thread,// added
std.stdio;
void main()
{
auto pid = fork();
if( pid> 0 ) {
thread_attachThis();// adde
Correction:
Of course, you shouldn't call thread_attachThis() for the parent thread. It's
already been attached since the D runtime created it. (In fact, the
documentation says: "If [thread_attachThis()] is called for a thread which is
already registered, the result is undefined." My bad.)
B
On Tue, 22 Jun 2010 06:32:21 +0900, Byron Heads
wrote:
When I use fork I am getting a core.thread.ThreadException: Unable to
load thread state exception.
This is dmd 2.047 on OS X
I am trying to convert a small C application.
module fork;
import core.sys.posix.unistd,
std.stdio;
On 2010-06-21 23:32, Byron Heads wrote:
When I use fork I am getting a core.thread.ThreadException: Unable to
load thread state exception.
This is dmd 2.047 on OS X
I am trying to convert a small C application.
module fork;
import core.sys.posix.unistd,
std.stdio;
void main()
{
On Mon, 21 Jun 2010 21:32:21 +, Byron Heads wrote:
> When I use fork I am getting a core.thread.ThreadException: Unable to
> load thread state exception.
>
> This is dmd 2.047 on OS X
> I am trying to convert a small C application.
>
This runs fine under linux
-Byron