I want to add multithreading to a language (BlitzBasic) that doesn't support multithreading or function pointers, but does support running functions from a .dll
The language's compiler compiles to some form of C which is then compiled to native code. It is Windows-only.
My idea so far was to make a function in a dll that would be called from within BlitzBasic. This function would check the call stack to find out from where it was called. It would then fork a new thread and return. The new thread would wait for a short while (10ms or so) and then resume execution at the point from where the function was called in BlitzBasic. In BlitzBasic you'd then have to control the rest of the execution based on that delay (so the first thread to get out of that function would e.g. set a variable that would tell the second thread to execute some different function.
I know that multithreading introduces a lot of other problems, but I'll cross that bridge when I get there.
Is there a way to find the execution point of a function in the callstack?