mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-01 08:48:29 +00:00
Make detached threads work better
This change adds a double linked list of threads, so that pthread_exit() will know when it should call exit() from an orphaned child. This change also improves ftrace and strace logging.
This commit is contained in:
parent
b74d8c1acd
commit
cee6871710
37 changed files with 638 additions and 314 deletions
|
@ -45,18 +45,17 @@ extern unsigned __tls_index;
|
|||
void __require_tls(void);
|
||||
void __set_tls(struct CosmoTib *);
|
||||
|
||||
#if defined(__GNUC__) && defined(__x86_64__) && !defined(__STRICT_ANSI__)
|
||||
/**
|
||||
* Returns location of thread information block.
|
||||
*
|
||||
* This can't be used in privileged functions.
|
||||
*/
|
||||
static inline struct CosmoTib *__get_tls(void) {
|
||||
struct CosmoTib *_tib;
|
||||
asm("mov\t%%fs:0,%0" : "=r"(_tib) : /* no inputs */ : "memory");
|
||||
return _tib;
|
||||
}
|
||||
#endif /* GNU x86-64 */
|
||||
#define __get_tls() \
|
||||
({ \
|
||||
struct CosmoTib *_t; \
|
||||
asm("mov\t%%fs:0,%0" : "=r"(_t) : /* no inputs */ : "memory"); \
|
||||
_t; \
|
||||
})
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue