Page MenuHomeFreeBSD

Implement mtx_trylock_spin(9).
ClosedPublic

Authored by kib on Jul 12 2016, 3:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 7:18 AM
Unknown Object (File)
Dec 20 2023, 2:26 AM
Unknown Object (File)
Dec 15 2023, 1:13 PM
Unknown Object (File)
Dec 13 2023, 4:20 AM
Unknown Object (File)
Nov 30 2023, 7:16 AM
Unknown Object (File)
Nov 12 2023, 3:21 AM
Unknown Object (File)
Nov 8 2023, 11:40 AM
Unknown Object (File)
Nov 7 2023, 6:31 PM
Subscribers

Details

Reviewers
jhb
Group Reviewers
manpages
Commits
rS303211: Implement mtx_trylock_spin(9).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib retitled this revision from to Implement mtx_trylock_spin(9)..
kib updated this object.
kib edited the test plan for this revision. (Show Details)
kib added a reviewer: jhb.
kib set the repository for this revision to rS FreeBSD src repository - subversion.
sys/kern/kern_mutex.c
296 ↗(On Diff #18306)

Please use 'mtx_trylock_spin' in these kassert messages.

306 ↗(On Diff #18306)

Try-lock operations don't generally invoke checkorder since they can't block (so can't deadlock). They also don't define new orders either.

kib marked 2 inline comments as done.

Remove CHECKORDER call.
Change function names in the kassert messages.
Fix UP compilation.

Bde requests:
add comment into mutex.h
change assert for recursion.

jhb edited edge metadata.

Implementation looks fine. I missed earlier though that mutex.9 should be updated as well.

This revision is now accepted and ready to land.Jul 18 2016, 12:49 PM
In D7192#150431, @jhb wrote:

Implementation looks fine. I missed earlier though that mutex.9 should be updated as well.

Sure, I waited until the code changes are accepted.

kib edited edge metadata.

Document mtx_trylock_spin(9).

This revision now requires review to proceed.Jul 18 2016, 1:45 PM
kib edited edge metadata.

Install symlink.

jhb edited edge metadata.
jhb added inline comments.
share/man/man9/mutex.9
44 ↗(On Diff #18508)

Also mtx_trylock_spin_flags?

This revision is now accepted and ready to land.Jul 18 2016, 2:34 PM
share/man/man9/mutex.9
44 ↗(On Diff #18508)

MTX_RECURSE is not supported, and MTX_QUIT is useless.

I did not mentioned mtx_trylock_spin_flags() because I do not see how it could be useful. Its presence is just an implementation detail (cannot avoid defining it without breaking all ten layers of macros).

I will add that if you consider that important.

share/man/man9/mutex.9
44 ↗(On Diff #18508)

Ok. The only one I thought could be useful would be MTX_QUIET since it does use LOCK_LOG_TRY.

kib edited edge metadata.

Document mtx_trlock_spin_flags.

Mention mtx_trylock* in the description of MTX_RECURSE flag.

This revision now requires review to proceed.Jul 19 2016, 6:02 AM
jhb edited edge metadata.
jhb added inline comments.
share/man/man9/mutex.9
468 ↗(On Diff #18535)

Perhaps "support recursion; that is, attempting to acquire an already-owned mutex fails."

This does seem to be a bit of an odd bit of the API (perhaps its my fault or perhaps we inherited it from BSD/OS?)

This revision is now accepted and ready to land.Jul 22 2016, 8:59 PM
share/man/man9/mutex.9
468 ↗(On Diff #18535)

It can be changed to support recursion, but all uses of trylock must be audited. I think it is not critical in any way.

This revision was automatically updated to reflect the committed changes.