mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-11 21:49:12 +00:00
Make improvements to locking
This change makes pthread_mutex_lock() as fast as _spinlock() by default. Thread instability issues on NetBSD have been resolved. Improvements made to gdtoa thread code. Crash reporting will now synchronize between threads in a slightly better way.
This commit is contained in:
parent
25041b8026
commit
d5312b60f7
60 changed files with 890 additions and 629 deletions
14
third_party/gdtoa/lock.h
vendored
14
third_party/gdtoa/lock.h
vendored
|
@ -7,13 +7,19 @@ COSMOPOLITAN_C_START_
|
|||
|
||||
int __gdtoa_lock(void);
|
||||
int __gdtoa_unlock(void);
|
||||
int __gdtoa_lock1(void);
|
||||
int __gdtoa_unlock1(void);
|
||||
|
||||
#if defined(__GNUC__) && !defined(__llvm__) && !defined(__STRICT_ANSI__)
|
||||
#define __gdtoa_lock() _NOPL0("__threadcalls", __gdtoa_lock)
|
||||
#define __gdtoa_unlock() _NOPL0("__threadcalls", __gdtoa_unlock)
|
||||
#define __gdtoa_lock() _NOPL0("__threadcalls", __gdtoa_lock)
|
||||
#define __gdtoa_unlock() _NOPL0("__threadcalls", __gdtoa_unlock)
|
||||
#define __gdtoa_lock1() _NOPL0("__threadcalls", __gdtoa_lock1)
|
||||
#define __gdtoa_unlock1() _NOPL0("__threadcalls", __gdtoa_unlock1)
|
||||
#else
|
||||
#define __gdtoa_lock() (__threaded ? __gdtoa_lock() : 0)
|
||||
#define __gdtoa_unlock() (__threaded ? __gdtoa_unlock() : 0)
|
||||
#define __gdtoa_lock() (__threaded ? __gdtoa_lock() : 0)
|
||||
#define __gdtoa_unlock() (__threaded ? __gdtoa_unlock() : 0)
|
||||
#define __gdtoa_lock1() (__threaded ? __gdtoa_lock1() : 0)
|
||||
#define __gdtoa_unlock1() (__threaded ? __gdtoa_unlock1() : 0)
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue