www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - CreateThread?

reply Pavel <pavel.korabecny email.cz> writes:
I create win32 application. (use dmd 2.046)
Exist object Thread in std.thread. Object Thread gives support for garbage
collector,  but I want to use
the function CreateThread.
Can I create threads with this function?
May 28 2010
next sibling parent Kagamin <spam here.lot> writes:
Pavel Wrote:

 I create win32 application. (use dmd 2.046)
 Exist object Thread in std.thread. Object Thread gives support for garbage
 collector,  but I want to use
 the function CreateThread.
 Can I create threads with this function?

Yes, you can. You just shouldn't use data allocated in D heap. And may be TLS.
May 28 2010
prev sibling parent reply BCS <none anon.com> writes:
Hello Pavel,

 I create win32 application. (use dmd 2.046)
 Exist object Thread in std.thread. Object Thread gives support for
 garbage
 collector,  but I want to use
 the function CreateThread.
 Can I create threads with this function?

You can call it (you can call any C function). It should give you a new thread. It might break something else in D (for example: the GC pauses all threads for a collection and that might break) Why do you want to use CreateThread? -- ... <IXOYE><
May 28 2010
parent reply Pavel <pavel psi.cz> writes:
I need call WaitForMultipleObject for thread and event handle.
Object Thread in std.thread hide the handle, but create support for GC.
Do you GC pause this my thread? (use dmd 2.046) (This thread is not in the
global
list of threads)
How can I do to support my threads for GC??

Pavel
May 31 2010
parent Pavel <pavel psi.cz> writes:
I solved. Just use the function thread_attachThis() and thread_detachThis().
May 31 2010