Skip to content

Commit

Permalink
added RAIIMutex object (resource acquisition is initialization) to pr…
Browse files Browse the repository at this point in the history
…event functions to "forget" releasing a locked mutex.

Signed-off-by: Marcos Paulo Berteli Slomp <[email protected]>
  • Loading branch information
slomp committed Feb 17, 2011
1 parent 627e445 commit 16d43bb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions platform/windows/libusb10emu/libusb-1.0/libusbemu_threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,16 @@
// #include "libusbemu_threads_pthread.h"
#endif

namespace libusbemu
{

struct RAIIMutex
{
QuickMutex& m_mutex;
RAIIMutex(QuickMutex& mutex) : m_mutex(mutex) { m_mutex.Enter(); }
~RAIIMutex() { m_mutex.Leave(); }
};

};

#endif//LIBUSBEMU_THREAD_INTERFACE_WRAPPER_H

0 comments on commit 16d43bb

Please sign in to comment.