Here’s a useful library for you to be aware of for your concurrent OS X and iPhone programming: Plausible ActorKit, which aims to make interthread messaging easily manageable from any Objective-C object.
The purpose of ActorKit is to facilitate the implementation of concurrent software on both the desktop (Mac OS X) and embedded devices (iPhone OS). On the iPhone, thread-based concurrency is a critical tool in achieving high interface responsiveness while implementing long-running and potentially computationally expensive background processing. On Mac OS X, thread-based concurrency opens the door to leveraging the power of increasingly prevalent multi-core desktop computers.
To this end, ActorKit endeavours to provide easily understandable invariants for concurrent software:
- All threads are actors.
- Any actor may create additional actors.
- Any actor may asynchronously deliver a message to another actor.
- An actor may synchronously wait for message delivery from another actor.
As an actor may only synchronously receive messages, no additional concurrency primitives are required, such as mutexes or condition variables.
Building on this base concurrency model, ActorKit provides facilities for proxying Objective-C method invocations between threads, providing direct, transparent, synchronous and asynchronous execution of Objective-C methods on actor threads.
The source is available free and MIT-licensed from Google Code; current (beta 2) documentation can be found here. If a project we’re looking at that involves some very complicated Windows RPC code actually gets started, you’ll be hearing more from us on how well this library works in practice!
h/t: iPhoneSDK!
