mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 12:18:31 +00:00
Reduce makefile dependencies by 10%
The includes in libc/calls/calls.h have now been refactored so that functions with struct parameters are declared in libc/calls/struct/
This commit is contained in:
parent
4e7ce1538c
commit
adac64a52b
202 changed files with 372 additions and 319 deletions
|
@ -1,15 +1,11 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_INTRIN_SPINLOCK_H_
|
||||
#define COSMOPOLITAN_LIBC_INTRIN_SPINLOCK_H_
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/intrin/lockcmpxchg.h"
|
||||
#include "libc/intrin/lockcmpxchgp.h"
|
||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||
│ cosmopolitan § spinlocks ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
privileged unsophisticated locking subroutines */
|
||||
|
||||
#if IsModeDbg() && !defined(_SPINLOCK_DEBUG)
|
||||
#if defined(MODE_DBG) && !defined(_SPINLOCK_DEBUG)
|
||||
#define _SPINLOCK_DEBUG
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +13,7 @@
|
|||
#define _spinlock(lock) _spinlock_ndebug(lock)
|
||||
#define _spinlock_ndebug(lock) _spinlock_cooperative(lock)
|
||||
#define _trylock(lock) _trylock_debug(lock)
|
||||
#define _seizelock(lock) _seizelock_impl(lock, gettid())
|
||||
#define _seizelock(lock) _seizelock_impl(lock, _spinlock_gettid())
|
||||
#elif defined(TINY)
|
||||
#define _spinlock(lock) _spinlock_tiny(lock)
|
||||
#define _spinlock_ndebug(lock) _spinlock_tiny(lock)
|
||||
|
@ -72,12 +68,14 @@
|
|||
} else if (++__tries & 7) { \
|
||||
__builtin_ia32_pause(); \
|
||||
} else { \
|
||||
sched_yield(); \
|
||||
_spinlock_yield(); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
int _spinlock_gettid(void);
|
||||
int _trylock_debug_4(int *, const char *, const char *, int, const char *);
|
||||
void _spinlock_debug_4(int *, const char *, const char *, int, const char *);
|
||||
void _spinlock_yield(void);
|
||||
|
||||
#endif /* COSMOPOLITAN_LIBC_INTRIN_SPINLOCK_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue