Added validity check to task handles and fixed some clang-tidy warning in MIJIN_ASSERT.
This commit is contained in:
parent
89bb110116
commit
617e051943
@ -416,6 +416,11 @@ public:
|
|||||||
TaskHandle& operator=(const TaskHandle&) = default;
|
TaskHandle& operator=(const TaskHandle&) = default;
|
||||||
TaskHandle& operator=(TaskHandle&&) = default;
|
TaskHandle& operator=(TaskHandle&&) = default;
|
||||||
|
|
||||||
|
[[nodiscard]] bool isValid() const noexcept
|
||||||
|
{
|
||||||
|
return !state_.expired();
|
||||||
|
}
|
||||||
|
|
||||||
void cancel() const noexcept
|
void cancel() const noexcept
|
||||||
{
|
{
|
||||||
if (std::shared_ptr<TaskSharedState> state = state_.lock())
|
if (std::shared_ptr<TaskSharedState> state = state_.lock())
|
||||||
|
@ -56,15 +56,15 @@ if (!static_cast<bool>(condition))
|
|||||||
/* static bool ignoreAll = false; */ \
|
/* static bool ignoreAll = false; */ \
|
||||||
if (true) /*!ignoreAll */ \
|
if (true) /*!ignoreAll */ \
|
||||||
{ \
|
{ \
|
||||||
mijin::AssertionResult assertion_result__ = mijin::handleAssert(#condition,\
|
const mijin::AssertionResult assertion_result__ = mijin::handleAssert( \
|
||||||
msg, MIJIN_FUNC(), __FILE__, __LINE__); \
|
#condition, msg, MIJIN_FUNC(), __FILE__, __LINE__); \
|
||||||
switch (assertion_result__) \
|
switch (assertion_result__) \
|
||||||
{ \
|
{ \
|
||||||
case mijin::AssertionResult::ABORT: \
|
case mijin::AssertionResult::ABORT: \
|
||||||
std::abort(); \
|
std::abort(); \
|
||||||
break; \
|
break; \
|
||||||
case mijin::AssertionResult::IGNORE: \
|
case mijin::AssertionResult::IGNORE: \
|
||||||
break; \
|
/*break*/; \
|
||||||
case mijin::AssertionResult::IGNORE_ALL: \
|
case mijin::AssertionResult::IGNORE_ALL: \
|
||||||
/* ignoreAll = true; */ \
|
/* ignoreAll = true; */ \
|
||||||
break; \
|
break; \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user