Skip to content

Commit c999153

Browse files
committed
Cannot throw in destructors
1 parent 925d243 commit c999153

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Core/JsRuntime/Include/Babylon/JsRuntimeScheduler.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace Babylon
4848
// **IMPORTANT**:
4949
// 1. To prevent continuations from accessing freed memory, the destructor of the N-API class is expected to call
5050
// `Rundown()` which blocks execution until all of its schedulers are invoked. Failing to do so will result in
51-
// an exception if there are outstanding schedulers not yet invoked.
51+
// an assert if there are outstanding schedulers not yet invoked.
5252
// 2. The last continuation that accesses members of the N-API object, including the cancellation associated with
5353
// the continuation, must capture a persistent reference to the N-API object itself to prevent the GC from
5454
// collecting the N-API object during the asynchronous operation. Failing to do so will result in a hang
@@ -68,10 +68,7 @@ namespace Babylon
6868

6969
~JsRuntimeScheduler()
7070
{
71-
if (m_count > 0)
72-
{
73-
throw std::runtime_error{"Schedulers for the JavaScript thread are not yet invoked"};
74-
}
71+
assert(m_count == 0 && "Schedulers for the JavaScript thread are not yet invoked");
7572
}
7673

7774
// Wait until all of the schedulers are invoked.

0 commit comments

Comments
 (0)