rename dtls_lock to slab_lock
Rename alocate to allocate (wtf?)
Use __sync instead of lock around ref count

No need to protect the valid field with a lock, as it's inherently racy
anyway.