monotone

monotone Mtn Source Tree

Root/botan/mutex.h

1/*************************************************
2* Mutex Header File *
3* (C) 1999-2005 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_MUTEX_H__
7#define BOTAN_MUTEX_H__
8
9namespace Botan {
10
11/*************************************************
12* Mutex Base Class *
13*************************************************/
14class Mutex
15 {
16 public:
17 virtual void lock() = 0;
18 virtual void unlock() = 0;
19 virtual Mutex* clone() const = 0;
20 virtual ~Mutex() {}
21 };
22
23/*************************************************
24* Mutex Holding Class *
25*************************************************/
26class Mutex_Holder
27 {
28 public:
29 Mutex_Holder(Mutex* m) : mux(m) { mux->lock(); }
30 ~Mutex_Holder() { mux->unlock(); }
31 private:
32 Mutex* mux;
33 };
34
35/*************************************************
36* Get/set a mutex *
37*************************************************/
38Mutex* get_mutex();
39void initialize_mutex(Mutex*&);
40
41}
42
43#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status