aboutsummaryrefslogtreecommitdiffstats
path: root/src/mutex.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-23 10:34:49 +0000
committerlloyd <[email protected]>2006-06-23 10:34:49 +0000
commit571fea5ac667b88a66604ecdba05d8324f5e9de7 (patch)
treefc7f8191e779ad3dc6fb2e4ac4e6c9f2acfed7c3 /src/mutex.cpp
parent714fe898764407cdb9ebcea30cbc69bf1a4bada8 (diff)
Inline a number of small objects that are only used in a local context
(ie, a single function). This will, unfortunately, break GCC 2.95.x support. Most of the operating systems that had shipped with 2.95.x, like OpenBSD and QNX, have since upgraded. Anyone needing 2.95.x support will have to continue using 1.4.x
Diffstat (limited to 'src/mutex.cpp')
-rw-r--r--src/mutex.cpp59
1 files changed, 22 insertions, 37 deletions
diff --git a/src/mutex.cpp b/src/mutex.cpp
index 1b6c7b2d6..f96849409 100644
--- a/src/mutex.cpp
+++ b/src/mutex.cpp
@@ -7,43 +7,6 @@
namespace Botan {
-namespace {
-
-/*************************************************
-* Default Mutex *
-*************************************************/
-class Default_Mutex : public Mutex
- {
- public:
- void lock();
- void unlock();
- Default_Mutex() { locked = false; }
- private:
- bool locked;
- };
-
-/*************************************************
-* Lock the mutex *
-*************************************************/
-void Default_Mutex::lock()
- {
- if(locked)
- throw Internal_Error("Default_Mutex::lock: Mutex is already locked");
- locked = true;
- }
-
-/*************************************************
-* Unlock the mutex *
-*************************************************/
-void Default_Mutex::unlock()
- {
- if(!locked)
- throw Internal_Error("Default_Mutex::unlock: Mutex is already unlocked");
- locked = false;
- }
-
-}
-
/*************************************************
* Mutex_Holder Constructor *
*************************************************/
@@ -67,6 +30,28 @@ Mutex_Holder::~Mutex_Holder()
*************************************************/
Mutex* Mutex_Factory::make()
{
+ class Default_Mutex : public Mutex
+ {
+ public:
+ void lock()
+ {
+ if(locked)
+ throw Internal_Error("Default_Mutex::lock: Mutex is already locked");
+ locked = true;
+ }
+
+ void unlock()
+ {
+ if(!locked)
+ throw Internal_Error("Default_Mutex::unlock: Mutex is already unlocked");
+ locked = false;
+ }
+
+ Default_Mutex() { locked = false; }
+ private:
+ bool locked;
+ };
+
return new Default_Mutex;
}