If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

TBEM: internal multiple threads

Mike,

while talking with ISAWHIM about thinBasic Callbacks and other stuff about function pointers, I was thinking about a more generalized TBEM way to check if a an event must be fired.

Currently for TBEM to properly works, there is the necessity to add a TBEM_Run call in a loop.
What about if TBEM, on startup, creates an internal thread and use it to internally check about events? Maybe a new keyword like TBEM_InstallThread (or something like that) could be used to instruct TBEM the script wants to go with TBEM internal thread while if no TBEM_InstallThread than TBEM_Run is still valid.

This method can add a more general use of TBEM and possibly fire events even if main thinCore engine is busy on long execution scripts that will not let the execution cursor return into the main loop and fire a new TBEM_Run. This last part is still to be tested though.

Re: TBEM: internal multiple threads

Well, to be that means less controll in the app. For games I can't see an advantage but maybe there is one for apps.

But most important, can you secure me that it is possible to run two functions at the same time? I allways understood that you can't run several scripts and so functions in the same environment and at the same time.

Did I understood it correctly that you want to give an event a flag to either react on TBEM_RUN or to act on the internal thread?

Re: TBEM: internal multiple threads

I cannot guarantee that it would work 100%

thinBasic cannot run more than one piece of code at the same time but what it can do is stop execution at the current execution pointer, jump into a new called function and return at the same previous execution pointer. If execution of the called function is quite fast, it can seems to be multi thread even if not.

I think I will have some spare time in next week-end so maybe I can check possibility to do what is in my head and confirm you if possible or not.
If I produce some usable code I will send it to you and you will decide.