Re: AppleScript's Threadedness…
Re: AppleScript's Threadedness…
- Subject: Re: AppleScript's Threadedness…
- From: Chris Page <email@hidden>
- Date: Sun, 14 Dec 2008 06:14:13 -0800
On Dec 11, 2008, at 11:57 AM, has wrote:
Let's say I'm writing an OSA component [1] for a language whose
interpreter needs to be hosted in a separate process from the
process that's loaded the OSA component itself, e.g. because the
interpreter doesn't provide adequate insulation between unrelated
scripts. What would be the best IPC mechanism to tie the OSA
component to the interpreter process(es), bearing in mind that they
need full two-way communication (e.g. the component needs to tell
the interpreter to compile a script or call its handlers; the
interpreter needs to dispatch Apple events via the component's
sendProc), and good performance remains important despite all the
crossing of process boundaries?
It's hard to say without more information, but generally speaking the
preferred IPC mechanism on Mac OS X is mach messages. Most of the
other IPC mechanisms are implemented in terms of mach messages. If
there's one that provides you with a more appropriate higher level API
go with that. Raw mach messages are a little, well, raw.
There's an RPC mechanism immediately above mach messages (see "mig").
Apple Events are sent via mach messages, too. If you're using
Objective-C you can use Distributed Objects to just send messages to
objects in other processes, which is probably the most convenient and
high-level IPC approach.
Large mach messages with lots of data are transferred quickly, using
memory mapping to avoid copying.
--
Chris Page
The other, other AppleScript Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden