Re: Best Strategy to Control iTunes
Re: Best Strategy to Control iTunes
- Subject: Re: Best Strategy to Control iTunes
- From: Ammar Ibrahim <email@hidden>
- Date: Thu, 2 Apr 2009 16:22:18 +0300
On Thu, Apr 2, 2009 at 12:07 AM, Bill Bumgarner <email@hidden> wrote:
> On Apr 1, 2009, at 2:04 PM, ammar.ibrahim wrote:
>
>> Right now, I'm more confused than I was, hehe. My question is: Why would I
>>> care about thread safety? Assuming that everytime I communicate with
>>> iTunes
>>> I create a thread and have the communication happen from there, even if
>>> it's
>>> blocking and times out, it wouldn't affect my main application. I'm I
>>> missing anything here? How would be the command line application any
>>> different from this?
>>>
>>
>
> Simply because you isolate your use of the AppleScript API to a thread does
> not make the API safe to use from that thread. You have no control over
> what other bits of framework infrastructure might tickle the thread-unsafe
> parts of the target API while updating the UI or responding to user events.
>
> By isolating the code to a subprocess -- a command line application -- it
> can be both single threaded and isolated from your application's threads.
>
To sum up, you mean I should use osascript in a separate process? How can I
achieve that, and how can I have this separate process communicate back to
the main process?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden