PDA

View Full Version : TBEM: internal multiple threads



ErosOlmi
23-10-2008, 08:02
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.

What do you think?

Ciao
Eros

Michael Hartlef
23-10-2008, 08:20
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?

ErosOlmi
23-10-2008, 08:31
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.

Ciao
Eros

Michael Hartlef
23-10-2008, 08:40
ok.