Re: Function Pointer Not Working

2020-11-19 Thread Marcone via Digitalmars-d-learn
I will wait with this code. WaitForSingleObject(threading, INFINITE);

Re: Function Pointer Not Working

2020-11-19 Thread Marcone via Digitalmars-d-learn
On Thursday, 19 November 2020 at 15:51:09 UTC, Kagamin wrote: The delegate is stored on the stack of the calling thread, the created thread loads it from there, but the calling thread doesn't wait for that and clobbers the stack right away. If you were lucky your code would crash. The thread

Re: Function Pointer Not Working

2020-11-19 Thread Kagamin via Digitalmars-d-learn
The delegate is stored on the stack of the calling thread, the created thread loads it from there, but the calling thread doesn't wait for that and clobbers the stack right away. If you were lucky your code would crash.

Re: Function Pointer Not Working

2020-11-19 Thread Marcone via Digitalmars-d-learn
Solved replacing this line: CreateThread(null, 0, &_fun, &fun, 0, null); to this code: task!({CreateThread(null, 0, &_fun, &fun, 0, null);}).executeInNewThread();

Re: Function Pointer Not Working

2020-11-18 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 19 November 2020 at 04:23:13 UTC, Marcone wrote: // Function threadingw() void threadingw(HWND hwn, void delegate() fun) nothrow { try { // Function _fun() extern(Windows) uint _fun(void * arg){ (*(cast(void delegate()*) arg)