Merge pull request #22 from jsonn/master

Reorganize code to use only 32bit atomic ops for 32bit platforms.
Rename lock_t to guard_lock_t to avoid conflicts with Solaris headers.