Donate Now Goal amount for this month: 100 USD, Received: 0 USD (0%)
Donate to support this site and ThinBASIC project development

Results 1 to 4 of 4

Thread: TBEM: internal multiple threads

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    47
    Posts
    7,556
    Blog Entries
    2
    Rep Power
    10

    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.

    What do you think?

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win7Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  2. #2
    Super Moderator Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Leverkusen, Germany
    Age
    48
    Posts
    3,151
    Blog Entries
    2
    Rep Power
    323

    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?

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    47
    Posts
    7,556
    Blog Entries
    2
    Rep Power
    10

    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.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win7Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  4. #4
    Super Moderator Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Leverkusen, Germany
    Age
    48
    Posts
    3,151
    Blog Entries
    2
    Rep Power
    323

    Re: TBEM: internal multiple threads

    ok.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •