mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-26 22:38:30 +00:00
Make Cosmo mutexes competitive with Apple Libc
While we have always licked glibc and musl libc on gnu/systemd sadly the Apple Libc implementation of pthread_mutex_t is better than ours. It may be due to how the XNU kernel and M2 microprocessor are in league when it comes to scheduling processes and the NSYNC behavior is being penalized. We can solve this by leaning more heavily on ulock using Drepper's algo. It's kind of ironic that Linux's official mutexes work terribly on Linux but almost as good as Apple Libc if used on MacOS.
This commit is contained in:
parent
2ec413b5a9
commit
90460ceb3c
13 changed files with 349 additions and 202 deletions
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "third_party/nsync/cv.h"
|
||||
|
@ -43,7 +44,7 @@ errno_t pthread_cond_signal(pthread_cond_t *cond) {
|
|||
#if PTHREAD_USE_NSYNC
|
||||
// favor *NSYNC if this is a process private condition variable
|
||||
// if using Mike Burrows' code isn't possible, use a naive impl
|
||||
if (!cond->_pshared) {
|
||||
if (!cond->_pshared && !IsXnuSilicon()) {
|
||||
nsync_cv_signal((nsync_cv *)cond);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue