arrp
0.0.15
Auto returning resource pool for modern C++
Loading...
Searching...
No Matches
common.hpp
1
#pragma once
2
#ifndef ASYNCHRONY_COMMON_HPP
3
#define ASYNCHRONY_COMMON_HPP
4
5
#include <exception>
6
7
8
namespace
siddiqsoft::arrp
9
{
17
enum
resource_pool_limits : uint8_t
18
{
19
DefaultCapacity = 8,
20
MaxCapacity = 128
21
};
22
67
static
bool
isCriticalException(
const
std::exception_ptr& ep)
68
{
69
if
(!ep)
return
false
;
70
71
try
{
72
std::rethrow_exception(ep);
73
}
74
catch
(
const
std::bad_alloc&) {
75
// Memory allocation failure - critical
76
return
true
;
77
}
78
catch
(
const
std::bad_exception&) {
79
// Bad exception - critical
80
return
true
;
81
}
82
catch
(
const
std::bad_cast&) {
83
// Bad cast - critical
84
return
true
;
85
}
86
catch
(
const
std::bad_typeid&) {
87
// Bad typeid - critical
88
return
true
;
89
}
90
catch
(
const
std::exception&) {
91
// Regular exception - not critical
92
return
false
;
93
}
94
catch
(...) {
95
// Unknown exception - treat as critical
96
return
true
;
97
}
98
}
99
}
// namespace siddiqsoft
100
101
#endif
// !ASYNCHRONY_COMMON_HPP
include
siddiqsoft
private
common.hpp
Generated on
for arrp by
1.16.1