Refers to TLRW: Return of the Read-Write Lock
Please read the paper firstly, if you don’t understand, please do NOT ask me.
I implemented the byte-lock, test on my Intel E5200 with at most 256 threads, works well. All the interfaces are clear and portable.
You can get the all code from Ortholab, under trunk/Lock/TLRW.