home *** CD-ROM | disk | FTP | other *** search
- ThreadedApp v 1.0
-
- Chris Roehrig <croehrig@House.ORG>
- March 1997
-
-
- Writing multi-threaded applications in NEXTSTEP is not as easy as it could
- be. I wrote ThreadedApp to make it easy to write multi-threaded
- applications that use the AppKit. In particular, it provides an easy
- mechanism for threads to use the AppKit features in a safe and robust way.
-
- So now there's no excuse not to use threads! Let's make those Apps
- RESPONSIVE!
-
-
- ThreadedApp
- Support for multi-threaded applications for NEXTSTEP 3.3.
-
- ThreadedApp is a subclass of Application that contains the functionality of
- the OpenStep NSThread object, but also provides increased support for
- interaction with the AppKit. The AppKit is not thread-safe and only the
- main thread can use it. All other threads must message the main thread
- to perform any functions (drawing, etc) that involve the AppKit.
- ThreadedApp does this by introducing the notion of callback methods.
- This is a flexible mechanism whereby a thread can request that the main
- application thread invoke a method on its behalf. This allows a thread
- to have virtually full access to the AppKit in a way that is easy to
- understand and use.
-
- The callback mechanism uses Mach messages to make requests to the main
- AppKit thread. The main thread only receives the messages when it is in
- an event loop, so it is crucial that the main thread remains responsive to
- events. (This is only good user-interface design anyways.)
-
- ThreadedApp provides support for locking shared data or code via the
- CJRLock and CJRConditionLock classes. These classes allow the main AppKit
- thread to "block" while waiting to acquire a lock, but still remain
- responsive to events so that other threads may still perform callbacks.
-
- Send any bug reports, comments, etc. to Chris Roehrig <croehrig@House.ORG>
- If you find ThreadedApp useful and are using it in an application, send me
- a note; I'd like to hear about it!
-
- Chris
-