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

Commit

Permalink
top ucontext_t needs to be TLS
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed May 29, 2011
1 parent 388e0f4 commit 0cbf6da
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/core/thread.d
Expand Up @@ -3344,15 +3344,22 @@ class Fiber
status = pthread_key_create( &sm_this, null );
assert( status == 0 );

static if( __traits( compiles, ucontext_t ) )
{
status = getcontext( &sm_utxt );
assert( status == 0 );
}
}
}


version( Posix )
{
static this()
{
static if( __traits( compiles, ucontext_t ) )
{
int status = getcontext( &sm_utxt );
assert( status == 0 );
}
}
}

private:
//
// Initializes a fiber object which has no associated executable function.
Expand Down Expand Up @@ -3691,8 +3698,8 @@ private:
static if( __traits( compiles, ucontext_t ) )
{
// NOTE: The static ucontext instance is used to represent the context
// of the main application thread.
__gshared ucontext_t sm_utxt = void;
// of the executing thread.
static ucontext_t sm_utxt = void;
ucontext_t m_utxt = void;
ucontext_t* m_ucur = null;
}
Expand Down

0 comments on commit 0cbf6da

Please sign in to comment.