mirror of
https://github.com/wqking/eventpp.git
synced 2024-12-25 23:30:49 +08:00
Removed slow assertion
This commit is contained in:
parent
55d50a01bf
commit
07fd020fb7
@ -116,7 +116,6 @@ The time complexity is O(1).
|
||||
Note: the caller must ensure the handle `before` is created by `this` CallbackList. If the caller can't ensure it, `ownsHandle` can be used
|
||||
to check if the handle `before` belongs to `this` CallbackList. The function `insert` can only be called if `ownsHandle(before)` returns true,
|
||||
otherwise, it's undefined behavior and it causes weird bugs.
|
||||
`insert` only `assert(ownsHandle(before))`, but there is no check in release code for performance reason.
|
||||
|
||||
#### remove
|
||||
```c++
|
||||
|
@ -208,7 +208,8 @@ public:
|
||||
|
||||
Handle insert(const Callback & callback, const Handle & before)
|
||||
{
|
||||
assert(before.expired() || ownsHandle(before));
|
||||
// Disable this assertion because it's too slow in debug mode.
|
||||
//assert(before.expired() || ownsHandle(before));
|
||||
|
||||
NodePtr beforeNode = before.lock();
|
||||
if(beforeNode) {
|
||||
@ -226,7 +227,8 @@ public:
|
||||
|
||||
bool remove(const Handle & handle)
|
||||
{
|
||||
assert(handle.expired() || ownsHandle(handle));
|
||||
// Disable this assertion because it's too slow in debug mode.
|
||||
//assert(handle.expired() || ownsHandle(handle));
|
||||
|
||||
// It looks like the lock can be put inside the `if` below,
|
||||
// but that doesn't work in multi-threading and cause related unit tests fail.
|
||||
|
Loading…
x
Reference in New Issue
Block a user