How to perform tasks in multiple threads

Is it possible to have a process running in a thread while another is executing in asobjc

Not as far as I know. ASOC is still single-threaded. The only way I get around that problem (in a very limited way) is to offload some tasks with do shell script command and adding another command at the end. Doing so unlocks the UI in my app and I just have to monitor the currently running shell app in the background. Not pretty, but works. I like to give some feedback to the user when i know something is going to take a long time to process, like with a progress bar with it’s “threaded animation” property set to true and a “XX time left…” message.

Besides, I believe that programming in multi-threaded “mode” ain’t that easy. A lot of work from the developer’s side I would assume. Apple didn’t invent Grand Central Dispatch for no reason! Just wish it was accessible from ASOC, would have been nice. I believe GCD is C#, not Obj-C.

Regards,
Fred

Model: MacBookPro2,2
Browser: Safari 531.9
Operating System: Mac OS X (10.6)

If the process is an Objective-C process or a Unix task, yes. You can actually put AS on a separate thread too, but because there’s only one instance of AS involved, it gains you nothing.

Yo should look at NSTask for this, if you haven’t already. It’s more efficient than do shell script, and makes it easier to keep the UI responsive.

Thanks guys, I’ve been looking at a few posts on here about how to use it, but I couldn’t fully piece it together, do you think you could give me a simple piece of NSTask sample code that works in ASOBJC

The code’s all there in other posts.