projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
setjmp: optimize longjmp prologues
[musl]
/
src
/
thread
/
__unmapself.c
diff --git
a/src/thread/__unmapself.c
b/src/thread/__unmapself.c
index
1d3bee1
..
31d94e6
100644
(file)
--- a/
src/thread/__unmapself.c
+++ b/
src/thread/__unmapself.c
@@
-4,7
+4,6
@@
/* cheat and reuse CRTJMP macro from dynlink code */
#include "dynlink.h"
/* cheat and reuse CRTJMP macro from dynlink code */
#include "dynlink.h"
-static volatile int lock;
static void *unmap_base;
static size_t unmap_size;
static char shared_stack[256];
static void *unmap_base;
static size_t unmap_size;
static char shared_stack[256];
@@
-17,12
+16,8
@@
static void do_unmap()
void __unmapself(void *base, size_t size)
{
void __unmapself(void *base, size_t size)
{
- int tid=__pthread_self()->tid;
char *stack = shared_stack + sizeof shared_stack;
stack -= (uintptr_t)stack % 16;
char *stack = shared_stack + sizeof shared_stack;
stack -= (uintptr_t)stack % 16;
- while (lock || a_cas(&lock, 0, tid))
- a_spin();
- __syscall(SYS_set_tid_address, &lock);
unmap_base = base;
unmap_size = size;
CRTJMP(do_unmap, stack);
unmap_base = base;
unmap_size = size;
CRTJMP(do_unmap, stack);