OGS
ThreadException.h
Go to the documentation of this file.
1
10
#pragma once
11
12
#include <exception>
13
#include <mutex>
14
22
class
ThreadException
23
{
24
public
:
25
void
capture
()
26
{
27
std::unique_lock<std::mutex> guard{
lock_
};
28
exception_
= std::current_exception();
29
}
30
31
void
rethrow
()
32
{
33
if
(
exception_
)
34
{
35
std::rethrow_exception(
exception_
);
36
}
37
}
38
39
explicit
operator
bool() const noexcept {
return
exception_
!=
nullptr
; }
40
41
private
:
42
std::exception_ptr
exception_
=
nullptr
;
43
std::mutex
lock_
;
44
};
ThreadException
Definition
ThreadException.h:23
ThreadException::rethrow
void rethrow()
Definition
ThreadException.h:31
ThreadException::exception_
std::exception_ptr exception_
Definition
ThreadException.h:42
ThreadException::lock_
std::mutex lock_
Definition
ThreadException.h:43
ThreadException::capture
void capture()
Definition
ThreadException.h:25
BaseLib
ThreadException.h
Generated by
1.10.0