mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
af7bd80430
This change introduces a new deadlock detector for Cosmo's POSIX threads implementation. Error check mutexes will now track a DAG of nested locks and report EDEADLK when a deadlock is theoretically possible. These will occur rarely, but it's important for production hardening your code. You don't even need to change your mutexes to use the POSIX error check mode because `cosmocc -mdbg` will enable error checking on mutexes by default globally. When cycles are found, an error message showing your demangled symbols describing the strongly connected component are printed and then the SIGTRAP is raised, which means you'll also get a backtrace if you're using ShowCrashReports() too. This new error checker is so low-level and so pure that it's able to verify the relationships of every libc runtime lock, including those locks upon which the mutex implementation depends.
15 lines
412 B
C
15 lines
412 B
C
#ifndef COSMOPOLITAN_THIRD_PARTY_GDTOA_LOCK_H_
|
|
#define COSMOPOLITAN_THIRD_PARTY_GDTOA_LOCK_H_
|
|
#include "libc/thread/thread.h"
|
|
COSMOPOLITAN_C_START_
|
|
|
|
extern pthread_mutex_t __gdtoa_lock_obj;
|
|
extern pthread_mutex_t __gdtoa_lock1_obj;
|
|
|
|
void __gdtoa_lock(void);
|
|
void __gdtoa_unlock(void);
|
|
void __gdtoa_lock1(void);
|
|
void __gdtoa_unlock1(void);
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* COSMOPOLITAN_THIRD_PARTY_GDTOA_LOCK_H_ */
|