[libc-commits] [PATCH] D74653: [libc] Add simple implementations of mtx_lock and mtx_unlock.

Fangrui Song via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Feb 14 15:16:07 PST 2020


MaskRay added a comment.

A mutex implementation will need congestion counts. If only a shim is needed, a bi-state mutex is sufficient.

I think pthread_mutex_timedlock and pthread_mutex_unlock can be implemented first, then rebase mtx_lock and mtx_unlock on pthread. A libc eventually has to implement pthread to be usable on a POSIX platform. It can be a shim, with just the basic functionality. Even if you don't want to think of pthread initially, mtx_lock should be based on mtx_timedlock.

We can assume Linux>=2.6.22 and use FUTEX_PRIVATE_FLAG.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74653/new/

https://reviews.llvm.org/D74653





More information about the libc-commits mailing list