Skip to content

Commit 8bc70e9

Browse files
tryfinallyJohnSully
authored andcommitted
unique lock used with cv.wait already owns mutex
1 parent 5b81303 commit 8bc70e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ae.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ int aeCreateRemoteFileEvent(aeEventLoop *eventLoop, int fd, int mask,
258258

259259
if (fSynchronous)
260260
{
261-
std::unique_lock<std::mutex> ulock(cmd.pctl->mutexcv);
261+
std::unique_lock<std::mutex> ulock(cmd.pctl->mutexcv, std::adopt_lock);
262262
cmd.pctl->cv.wait(ulock);
263263
ret = cmd.pctl->rval;
264264
delete cmd.pctl;
@@ -311,7 +311,7 @@ int aePostFunction(aeEventLoop *eventLoop, std::function<void()> fn, bool fSynch
311311
int ret = AE_OK;
312312
if (fSynchronous)
313313
{
314-
std::unique_lock<std::mutex> ulock(cmd.pctl->mutexcv);
314+
std::unique_lock<std::mutex> ulock(cmd.pctl->mutexcv, std::adopt_lock);
315315
cmd.pctl->cv.wait(ulock);
316316
ret = cmd.pctl->rval;
317317
delete cmd.pctl;

0 commit comments

Comments
 (0)