Raised This Month: $ Target: $400
 0% 

remove_task


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 12-27-2005 , 19:56  
Reply With Quote #5

Alternatively, you could use xs stock library's weird task system - if it still works on today's releases of the Small compiler. (I wrote it more than a year ago [don't expect it to be bug-free =P ] ).

Code:
#include <xs> // somewhere: xs_task_begin(1.5, "my_task", -1); // id=-1 means to auto-choose a free id xs_task_pushint(0xdeadbeef); xs_task_pushfl(123.456); xs_task_pushstr("Hello BAIL!"); new id = xs_task_end(); // id now contains the id! // on global scope: XS_MAKE_TASKFUNC(my_task) {    new id = xs_task_readid(); // What else would it do    new pcount = xs_task_paramcount();    log_amx("my_task called; id=%d", id);    for (new i = 0; i < pcount; ++i)    {       new ptype = xs_task_paramtype(i);       if (ptype == xs_int)          log_amx("Param%d: int: %d", i, xs_task_paramint(i));       else if (ptype == xs_float)          log_amx("Param%d: float: %f", i, xs_task_paramfl(i));       else if (ptype == xs_string)       {          new str[256];          xs_task_paramstr(i, str, 255);          log_amx("Param%d: string: %s", i, str);       }    } }

You get the idea. The definitions of all these functions (and macros) are in xs.inc, if you are interested. Note that it might represent measurable overhead to use these functions, so better don't use it in really heavily used and performacne critical stuff.

(I'm tired so sorry for any mistakes)
__________________
hello, i am pm
PM is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode