GSoC/GCI Archive
Google Code-in 2012 BRL-CAD

Implement mutex locking for Windows

completed by: Arjun Govindjee

mentors: Sean, Daniel Rossberg

BRL-CAD implements support for running in parallel on computers with multiple CPUs or cores. However, there are lots of ways to run in parallel. BRL-CAD runs on Windows, but presently only in a single-threaded mode. To make it work in parallel, we need to define how threads acquire a mutex lock.

This task involves implementing the necessary logic to acquire and release a mutex or semaphore on Windows. You can use either, but probably want to call CreateMutex(). This requires a very minor source code modification to just one file, but make sure it works with a simple test program. Make your test program call bu_semaphore_init()+bu_semaphore_acquire()+bu_semahpore_release(), see include/bu.h for API docs.

References:

Code:

  • src/libbu/semaphore.c