mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-01 08:48:29 +00:00
Get rid of kmalloc()
This changes *NSYNC to allocate waiters on the stack so our locks don't need to depend on dynamic memory. This make our runtiem simpler, and it also fixes bugs with thread cancellation support.
This commit is contained in:
parent
77a7873057
commit
a359de7893
57 changed files with 405 additions and 472 deletions
|
@ -33,7 +33,7 @@
|
|||
|
||||
#define pagesz 16384
|
||||
#define SYSLIB_MAGIC ('s' | 'l' << 8 | 'i' << 16 | 'b' << 24)
|
||||
#define SYSLIB_VERSION 1
|
||||
#define SYSLIB_VERSION 2
|
||||
|
||||
struct Syslib {
|
||||
int magic;
|
||||
|
@ -56,6 +56,9 @@ struct Syslib {
|
|||
long (*dispatch_semaphore_signal)(dispatch_semaphore_t);
|
||||
long (*dispatch_semaphore_wait)(dispatch_semaphore_t, dispatch_time_t);
|
||||
dispatch_time_t (*dispatch_walltime)(const struct timespec *, int64_t);
|
||||
/* v2 (2023-09-10) */
|
||||
pthread_t (*pthread_self)(void);
|
||||
void (*dispatch_release)(dispatch_semaphore_t);
|
||||
};
|
||||
|
||||
#define ELFCLASS32 1
|
||||
|
@ -829,6 +832,8 @@ int main(int argc, char **argv, char **envp) {
|
|||
M->lib.dispatch_semaphore_signal = dispatch_semaphore_signal;
|
||||
M->lib.dispatch_semaphore_wait = dispatch_semaphore_wait;
|
||||
M->lib.dispatch_walltime = dispatch_walltime;
|
||||
M->lib.pthread_self = pthread_self;
|
||||
M->lib.dispatch_release = dispatch_release;
|
||||
|
||||
/* getenv("_") is close enough to at_execfn */
|
||||
execfn = argc > 0 ? argv[0] : 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue