boostorg / boostorg/fiber

Why `fiber::mutex` yields in `try_lock` even after acquiring the lock successfully?

Open
#331 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
510
Forks
123
PR merge metrics
No merged PRs in 30d

Description

Recently I'm reading the source code of `fiber::mutex`, I noticed that`fiber::mutex` will yield in `try_lock` no matter whether holding the lock or not? What's the considerations behind it, and can we just return immediately after lock? Thanks in advance.
https://github.com/boostorg/fiber/blob/238487b543e8863c647d31a82ccfc3fa11a960d9/src/mutex.cpp#L43-L60

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.