mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 18:28:30 +00:00
Serialize ZipOS handle IO across threads
This commit is contained in:
parent
0f1ead8943
commit
a808b3e738
7 changed files with 18 additions and 6 deletions
|
@ -21,6 +21,7 @@
|
|||
#include "libc/intrin/asancodes.h"
|
||||
#include "libc/intrin/cmpxchg.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "libc/zipos/zipos.internal.h"
|
||||
|
||||
void __zipos_free(struct Zipos *z, struct ZiposHandle *h) {
|
||||
|
@ -28,6 +29,7 @@ void __zipos_free(struct Zipos *z, struct ZiposHandle *h) {
|
|||
__asan_poison((char *)h + sizeof(struct ZiposHandle),
|
||||
h->mapsize - sizeof(struct ZiposHandle), kAsanHeapFree);
|
||||
}
|
||||
pthread_mutex_destroy(&h->lock);
|
||||
__zipos_lock();
|
||||
do h->next = z->freelist;
|
||||
while (!_cmpxchg(&z->freelist, h->next, h));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue