Merge pull request #14 from fcbotelho/debugbuild

Added support for building in debug mode (that is compile with -DLW_DEBU...
Updated readme.md to include some useful high level stuff.

I am not entirely familiar with markdown syntax so this might take a few rounds to get
right.
Merge pull request #15 from fcbotelho/readme

Updated readme.md to include some useful high level stuff.
Consolidate magic field type and definition of enum to one file.

Makes it easy to know what exists and avoid collisions.
Add lock free stack structure.

Will be used to hold free lists of various objects.
Atomic cmpxchng for subpart of a 32 or 64 bit value.
Added a new "bitlock" abstraction.

2 bits out of a 32 bit or 64 bit values can be used as a lock. One for lock
and one to indicate waiters. The waiters are all kept on common lists. The hashing
of lock address to wait list is rather simple and we should put a simple crc lookup
table there instead.
Add trylock variant to bit locks.
Add async locking for lw_mutex.
Tidied up code a little. The thread_event_init/destroy fucntions do not belong in the .h
file as generally accessible. They are really only meaningful for the default domain
which uses pthread mutex+cv to implement them. As such added API functions for it to the
domain (thread_event_init/destroy).

Still to do: the waiter structure should have the thread_event be the last field as it will make
custom domains that extend thread_event easier to write. They won't have to split their state for the
thread event itself in 2 parts: one at the top with the thread_event and the rest extending the waiter_t
structure. Also, still longer term, the waiter_t itself should not dictate that the event be a thread_event.
It really just needs a base event there. Rest is really for the default domain to dictate.
Removed stray references to DD.
Move thread event to be last field of waiter.

Next step: make it a base event and hide all thread_event specific stuff in lw_waiter.c
Make waiter struct only have a base event and completely hid thread_event
within the waiter.c file's global/default domain definition.
Use of CLOCK_MONOTONIC was turned off for some reason. Turning it back on.
Change bitlock API to take in lock and wait mask.

It is a more convenient api when carving bitfields, less error prone as one can never
specify an index to exceed word size, and avoids the internal conversions from idx -> mask.
Add bitlock support to lw_condvar.
Add async locking to bitlocks.
Clarified name of module init/deinit functions. Added init/destory function for
bitlocks.
fix bug in bitlock code. add some more apis.
fixed swap with mask code to do the right thing: retry if masked bits change.
More tweaks to bitlocks. Will need more adjustment. Also added intergrated
cv bit to bitlocks.