[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Re: Background server processing



On Sun, Mar 05, 2006 at 02:49:55AM +0100, Andrzej Kopec wrote:
> But the problem is (in my case at least) the interpreter
> seems be frozen when it waits for Pipe to finish. Maybe
> I'm missing, but my example doesn't work: the second task
> is stopped
> until Pipe is not finished:
> the strange thing is that after Pipe has finished the second task "throws out" all overdue
> events (here: dots in Post and synths on server) at once. 

hmm, the problem is that lowlevel i/o in SC is blocking; it
would be really nice to have a mechanism that suspends a
task when an i/o operation blocks.

a sluggish workaround is using a program like sendOSC (in
the CNMAT osckit) or a ruby/python script to send a message
when the nrt synth is done, like this (untested):

Routine.run {
    var cond = Condition.new, exitCode = 0;

    OSCresponder(nil, "/scsynth_finished", { |time,resp,msg|
        exitCode = msg[1];
        resp.remove;
        cond.test = true;
        cond.signal;
    }).add;

    // this could be put in a script
    "( scsynth ... ; sendOSC -h localhost 57120 /scsynth_finished $? ) &".systemCmd;

    cond.wait;

    [\finished, exitCode].postln;
}

<sk>