Boost logo

Boost :

From: Michael D. Crawford (crawford_at_[hidden])
Date: 2002-06-12 07:59:59


I've mentioned this before, but I'd like to butt in and point out Andy Green's
excellent implementation of C++ threading that is
part of the ZooLib cross-platform application framework:

http://zoolib.sourceforge.net/

It is open source under the MIT License (same license as XFree86).

It even works on the classic mac os, which does not support preemptive threads.
He is able to simulate preemptive threading by running a scheduler whenever
someone tries to acquire a lock, switching thread contexts by hacking on the
setjmp/longjmp jump_buf structure (to give each thread its own stack) and having
a separate, normal Mac OS non-preemptive Thread Manager thread to use for calls
into the toolbox that have to be done the way the Mac OS requires.

The version of the code that is in CVS has pretty good support Carbon too, so
you can have native executables for Mac OS X.

The other platforms it supports are Win32, BeOS x86 and PowerPC and x86 Linux.

A small amount of assembly code is required to enable atomic arithmetic for the
reference counted smart pointer (ZRef) and some OS specific code is required for
things like semaphores and thread APIs that the library builds on top of.

If you only used the components required for threading, you only need to take a
few source files from the library. There is the thread, mutex, refcounting
sources, and there is some debugging support that does fancy things like detect
whether a debugger is present so it can do the right thing when an assertion is
triggered.

Michael D. Crawford
GoingWare Inc. - Expert Software Development and Consulting
http://www.goingware.com/
crawford_at_[hidden]

    Tilting at Windmills for a Better Tomorrow.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk