mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 09:20:29 +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
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "libc/zip.h"
|
||||
#include "libc/zipos/zipos.internal.h"
|
||||
|
||||
|
@ -31,6 +32,7 @@
|
|||
*/
|
||||
int64_t __zipos_lseek(struct ZiposHandle *h, int64_t offset, unsigned whence) {
|
||||
int64_t rc;
|
||||
pthread_mutex_lock(&h->lock);
|
||||
switch (whence) {
|
||||
case SEEK_SET:
|
||||
rc = offset;
|
||||
|
@ -50,5 +52,6 @@ int64_t __zipos_lseek(struct ZiposHandle *h, int64_t offset, unsigned whence) {
|
|||
} else {
|
||||
rc = einval();
|
||||
}
|
||||
pthread_mutex_unlock(&h->lock);
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue