I need to implement a cross-platform reader/writer lock, and I am not really sure about what to do:
- on the Mac, I could use pthreads - which, if I understand correctly, forms the core of the various systhread functions. But then, what to do in Windows? Using pthreads for Windows? (would that be a good idea?) Or the native API, which I really don't know?
- or I could implement a rw-lock based on the mutexes and condition variables of the Max API. It wouldn't probably be the most efficient mechanism in the world, but the context would not be very critical, with no more than two threads competing for the lock.
What do you think is the best strategy?