Forums > Javascript

task and immediate

June 1, 2006 | 2:45 pm

Hi,

Is there a way to make a task regular? According to the
documentation, you just have to set the immediate property of the
function to 1 so the Task will be executed in the high priority
thread, but with the example bellow, it reports 1 instead of 0.
If I call the Task from a high priority message, it doesn’t change
anything. Am I forgetting something?

ej

PS: this is on a mac, with latest versions of everything…

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 343 212 110 196617 < - call in low priority;
#P button 306 164 15 0;
#P newex 306 187 50 196617 del 1000;
#P message 306 210 33 196617 start;
#P message 320 231 29 196617 stop;
#P newex 306 254 76 196617 js highpriority;
#P comment 328 165 110 196617 < - call in high priority;
#P connect 5 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 1 0;
#P connect 2 0 1 0;
#P window clipboard copycount 7;

——— save as highpriority.js ———
var myTask = new Task(click, this);
myTask.interval = 100;

function start()
{
post("start is in the thread", max.mainthread, "n");
myTask.repeat();
}
start.immediate = 1;

function stop()
{
myTask.cancel();
}

function click()
{
post("task is in the thread", max.mainthread, "n");
outlet(0, "bang");
}
click.immediate = 1;


June 1, 2006 | 6:53 pm

Warning for Windows users:

This patch crashes Max when overdrive is on, as discussed in a recent thread.

Eric


Viewing 2 posts - 1 through 2 (of 2 total)