Botan 1.10.17

Public Member Functions | List of all members
Botan::Noop_Mutex_Factory Class Reference

`#include <mux_noop.h>`

Inheritance diagram for Botan::Noop_Mutex_Factory:

## Public Member Functions
Mutex * | make ()

## Detailed Description

No-Op Mutex Factory

Definition at line 18 of file mux_noop.h.

## Member Function Documentation

## ◆ make()

Mutex * Botan::Noop_Mutex_Factory::make | ( |  | ) |
| virtual

Returns
  newly allocated mutex

Implements Botan::Mutex_Factory.

Definition at line 15 of file mux_noop.cpp.

16 {
17 class Noop_Mutex : public Mutex
18 {
19 public:
20 class Mutex_State_Error : public Internal_Error
21 {
22 public:
23 Mutex_State_Error(const std::string& where) :
24 Internal_Error("Noop_Mutex::" + where + ": " +
25 "Mutex is already " + where + "ed") {}
26 };
27
28 void lock()
29 {
30 if(locked)
31 throw Mutex_State_Error("lock");
32 locked = true;
33 }
34
35 void unlock()
36 {
37 if(!locked)
38 throw Mutex_State_Error("unlock");
39 locked = false;
40 }
41
42 Noop_Mutex() { locked = false; }
43 private:
44 bool locked;
45 };
46
47 return new Noop_Mutex;
48 }

The documentation for this class was generated from the following files:

- src/mutex/noop_mutex/mux_noop.h
- src/mutex/noop_mutex/mux_noop.cpp