This patch enables the use of threads and locking mechanisms in SDL applications. The 'pthread' libary is used as backend. Not all features are currently supported. Fixes #185.