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

Re: [sc-dev] CocoaDialog works, sched doesn't

On Thursday, January 9, 2003, at 04:31 PM, crucial felix wrote:

I am using
NSThread + (void)detachNewThreadSelector:(SEL)aSelector toTarget:(id)aTarget withObject:(id)anArgument

to start a thread on an SCDialog object method that runs the modal dialog to get the file names.
so it should be a completely different thread than the app is running.

but scheduling is still interrupted.

when i select each file in the file browser, the app clock is
allowed to update briefly. (mouse event passed control back to the app).

when the dialog is finished, i use SC VM defer to run the method to set the
return values and call "ok" or "cancel".
that all works fine.

so after all this struggle, it doesn't seem like there is a way to get
sclang to spawn a thread ???

there has to be a way.

The problem is not sclang. It is Cocoa. I think the relevant bit of doc is here:

file://localhost/Developer/Documentation/Cocoa/TasksAndConcepts/ ProgrammingTopics/Multithreading/index.html#//apple_ref/doc/uid/ 10000057i

"Using the Application Kit from Multiple Threads"
"You can create a modal window on a secondary thread. The Application Kit blocks the calling secondary thread while the main thread is running the modal loop."

So you can get SystemClock to work. That is all I was wanting to make work. Getting AppClock to work is not possible I think. I noticed that holding down the mouse in the scroll bar in Safari will cause an mp3 file playing back in a safari window to stop playing after a few seconds. Perhaps the same kind of issue.

--- james mccartney   james@xxxxxxxxxxxxxx   <http://www.audiosynth.com>
SuperCollider - a real time synthesis programming language for the PowerMac.