cmccabe / lksmith

Locksmith
BSD 2-Clause "Simplified" License
43 stars 9 forks source link

Semaphore support #4

Open praetp opened 9 years ago

praetp commented 9 years ago

Hi, I was trying out your library but as mentioned it does not support semaphores. Do you think this would be hard to do ? Otherwise I might consider adding it.. Did not have a look at the source code though.

cmccabe commented 9 years ago

Hi spetsnaz84,

I think it would be relatively easy to treat semaphores similar to how I treat mutexes currently. The main difference is that semaphores can be released from threads other than the thread that acquired them, without causing undefined behavior. Otherwise, they are just the same as recursive mutexes.

best, Colin