www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - get os thread handles

reply "Sean Campbell" <sycam.inc gmail.com> writes:
How do i get an os thread handle from a thread object.
or are d thread not wrapped os threads.
Jul 20 2014
parent reply "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Sunday, 20 July 2014 at 09:34:46 UTC, Sean Campbell wrote:
 How do i get an os thread handle from a thread object.
 or are d thread not wrapped os threads.
They do wrap OS threads, but they encapsulate them in a cross-platform manner, and looking over Thread, it doesn't look like anything along the lines of an OS thread handle is exposed in the API. What do you need the OS thread handle for?
Jul 20 2014
parent reply "Sean Campbell" <sycam.inc gmail.com> writes:
On Sunday, 20 July 2014 at 09:53:52 UTC, Jonathan M Davis wrote:
 On Sunday, 20 July 2014 at 09:34:46 UTC, Sean Campbell wrote:
 How do i get an os thread handle from a thread object.
 or are d thread not wrapped os threads.
They do wrap OS threads, but they encapsulate them in a cross-platform manner, and looking over Thread, it doesn't look like anything along the lines of an OS thread handle is exposed in the API. What do you need the OS thread handle for?
sonce the standard so i can get pause/resume support for d threads
Jul 20 2014
parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Sunday, 20 July 2014 at 10:03:47 UTC, Sean Campbell wrote:
 On Sunday, 20 July 2014 at 09:53:52 UTC, Jonathan M Davis wrote:
 On Sunday, 20 July 2014 at 09:34:46 UTC, Sean Campbell wrote:
 How do i get an os thread handle from a thread object.
 or are d thread not wrapped os threads.
They do wrap OS threads, but they encapsulate them in a cross-platform manner, and looking over Thread, it doesn't look like anything along the lines of an OS thread handle is exposed in the API. What do you need the OS thread handle for?
sonce the standard so i can get pause/resume support for d threads
I'd suggest opening up an enhancement request. Assuming that that functionality exists across all of the various OSes, it can probably be added: https://issues.dlang.org You can also open an enhancement request for getting access to the OS thread handles, but my guess is that that wouldn't happen, because it makes it so that the Thread class no longer has full control, which would make it impossible to have any kind of safety for Thread (though it doesn't seem to currently have any such annotations). But if what you're looking for is thread functionality that is common across OSes, then there's a good chance that it's reasonable to add it to Thread, making it unnecessary to provide access to its innards. In the meantime, I expect that you'll have to either use the C APIs directly or create your own class which is a copy of Thread and tweak it to do what you need.
Jul 20 2014