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

Commit

Permalink
Expose a thread_setThis() function in core.thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrp committed Jun 6, 2012
1 parent 2886846 commit 62d6219
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/core/thread.d
Expand Up @@ -2125,6 +2125,22 @@ static Thread thread_findByAddr( Thread.ThreadAddr addr )
}


/**
* Sets the current thread to a specific reference. Only to be used
* when dealing with externally-created threads (in e.g. C code).
* The primary use of this function is when Thread.getThis() must
* return a sensible value in, for example, TLS destructors. In
* other words, don't touch this unless you know what you're doing.
*
* Params:
* t = A reference to the current thread. May be null.
*/
extern (C) void thread_setThis(Thread t)
{
Thread.setThis(t);
}


/**
* Joins all non-daemon threads that are currently running. This is done by
* performing successive scans through the thread list until a scan consists
Expand Down
13 changes: 13 additions & 0 deletions src/core/thread.di
Expand Up @@ -512,6 +512,19 @@ extern (C) void thread_detachByAddr( Thread.ThreadAddr addr );
static Thread thread_findByAddr( Thread.ThreadAddr addr );


/**
* Sets the current thread to a specific reference. Only to be used
* when dealing with externally-created threads (in e.g. C code).
* The primary use of this function is when Thread.getThis() must
* return a sensible value in, for example, TLS destructors. In
* other words, don't touch this unless you know what you're doing.
*
* Params:
* t = A reference to the current thread. May be null.
*/
extern (C) void thread_setThis(Thread t);


/**
* Joins all non-daemon threads that are currently running. This is done by
* performing successive scans through the thread list until a scan consists
Expand Down

0 comments on commit 62d6219

Please sign in to comment.