yab | yet another Basic for HAIKU
TeamID and ThreadID - Printable Version

+- yab | yet another Basic for HAIKU (https://yab.orgfree.com/forum)
+-- Forum: installing / troubleshooting / feature requests (https://yab.orgfree.com/forum/forumdisplay.php?fid=5)
+--- Forum: Fixing yab (https://yab.orgfree.com/forum/forumdisplay.php?fid=7)
+--- Thread: TeamID and ThreadID (/showthread.php?tid=36)



TeamID and ThreadID - lorglas - 08-25-2015

Hello,

i want to use TeamID and ThreadID.

when i type in the terminal:

yab -execute 'print thread get "ThreadID", "top"'

i get a number. if i type

yab -execute 'print thread get "ThreadID", "yab-IDE"' also.
it's ok, but when i want a number from a yab program i get -1

i mean i run a program from the ide and then i open a terminal and type
yab -execute 'print thread get "ThreadID", "ink.yab"' (ink.yab is my program in the yab-ide)
i get -1 and i don't understand this.

And i think that TeamID doesn't work.

Best Regards

lorglas


RE: TeamID and ThreadID - bbjimmy - 08-26-2015

Thread get and Thread remove work as documented. These are not the best tools for determining if a program is running or asking it to quit.

The "TeamID" for a running yab script will change depending on how the program was launched making it less useful for programming a solid app that uses this function. Examole:

Launch Clock.yab from a Terminal and the TeamID is "yab ./Clock.yab"

Launch it from Tracker and the TeamID changes to "yab /boot/home/yab_work/Programs/Examples/Clock.yab"

Launch it from within yab-IDE and it is even less obvious as the "yab" is replaced by "/boot/home/config/non-packaged/bin/yab" or "/boot/system/bin/yab" or "/boot/home/config/bin/yab" depending on how yab is installed. in any case, the path becomes too long to identify the Clock.yab by TeamID as only the first 64 bytes of the path are used.

ThreadID is the most useful, but only if the program is compiled using the BuildFactory. Yab scriptsis become simply one or more threads of the yab team.


Free Web Hosting