Serialize ZipOS handle IO across threads

This commit is contained in:
Justine Tunney 2023-02-23 06:24:49 -08:00
parent 0f1ead8943
commit a808b3e738
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
7 changed files with 18 additions and 6 deletions

View file

@ -1,6 +1,7 @@
#ifndef COSMOPOLITAN_LIBC_ZIPOS_ZIPOS_H_
#define COSMOPOLITAN_LIBC_ZIPOS_ZIPOS_H_
#include "libc/intrin/nopl.internal.h"
#include "libc/thread/thread.h"
#include "libc/thread/tls.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@ -15,6 +16,7 @@ struct ZiposUri {
struct ZiposHandle {
struct ZiposHandle *next;
pthread_mutex_t lock;
size_t size; /* byte length of `mem` */
size_t mapsize; /* total size of this struct */
size_t pos; /* read/write byte offset state */