Skip to content

Commit e9759d1

Browse files
committed
CRLF
1 parent b8dd7c7 commit e9759d1

25 files changed

+2404
-2404
lines changed
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
/* Reverse Lock Guard
2-
*
3-
* From: https://github.com/PokemonAutomation/
4-
*
5-
*/
6-
7-
#ifndef PokemonAutomation_ReverseLockGuard_H
8-
#define PokemonAutomation_ReverseLockGuard_H
9-
10-
#include "Common/Cpp/Exceptions.h"
11-
12-
namespace PokemonAutomation{
13-
14-
15-
template <class Mutex>
16-
class ReverseLockGuard{
17-
public:
18-
ReverseLockGuard(Mutex& lock)
19-
: m_lock(lock)
20-
{
21-
if (lock.try_lock()){
22-
throw InternalProgramError(
23-
nullptr, PA_CURRENT_FUNCTION,
24-
"Attempted to unlock an already unlocked lock."
25-
);
26-
}
27-
lock.unlock();
28-
}
29-
~ReverseLockGuard(){
30-
m_lock.lock();
31-
}
32-
33-
34-
private:
35-
Mutex& m_lock;
36-
};
37-
38-
39-
}
40-
#endif
1+
/* Reverse Lock Guard
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_ReverseLockGuard_H
8+
#define PokemonAutomation_ReverseLockGuard_H
9+
10+
#include "Common/Cpp/Exceptions.h"
11+
12+
namespace PokemonAutomation{
13+
14+
15+
template <class Mutex>
16+
class ReverseLockGuard{
17+
public:
18+
ReverseLockGuard(Mutex& lock)
19+
: m_lock(lock)
20+
{
21+
if (lock.try_lock()){
22+
throw InternalProgramError(
23+
nullptr, PA_CURRENT_FUNCTION,
24+
"Attempted to unlock an already unlocked lock."
25+
);
26+
}
27+
lock.unlock();
28+
}
29+
~ReverseLockGuard(){
30+
m_lock.lock();
31+
}
32+
33+
34+
private:
35+
Mutex& m_lock;
36+
};
37+
38+
39+
}
40+
#endif

0 commit comments

Comments
 (0)