rwlocks based on a few bits instead of entire words.

Will be useful to make proper iterators over lists. Also tidied up bitlock code
a little. Only 32 bit variant of bitlocks are currently implemented. 64 bit versions
should be possible to do by largely a cut paste job and adjusting argument decls.