Skip to content

Commit

Permalink
The first attempt to make cookfs thread-aware
Browse files Browse the repository at this point in the history
  • Loading branch information
chpock committed Jun 5, 2024
1 parent d92b6ae commit 071288d
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 41 deletions.
1 change: 1 addition & 0 deletions generic/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Cookfs_Vfs *Cookfs_VfsInit(Tcl_Interp* interp, Tcl_Obj* mountPoint,
vfs->commandToken = NULL;
vfs->interp = interp;
vfs->isDead = 0;
vfs->isAlive = 0;
#ifdef COOKFS_USETCLCMDS
vfs->isRegistered = 0;
#endif
Expand Down
11 changes: 11 additions & 0 deletions generic/vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ typedef struct Cookfs_Vfs {
Tcl_Command commandToken;

int isDead;
int isAlive;
#ifdef COOKFS_USETCLCMDS
int isRegistered;
#endif
Expand All @@ -26,6 +27,16 @@ typedef struct Cookfs_Vfs {
Cookfs_Fsindex *index;
Cookfs_Writer *writer;

#ifdef TCL_THREADS
Tcl_Mutex tdLock;
unsigned int tdNumRead;
unsigned int tdNumWrite;
Tcl_Condition tdCondRead;
Tcl_Condition tdCondWrite;
int tdLockCount;
Tcl_ThreadId tdOwner;
#endif

struct Cookfs_Vfs* nextVfs;
} Cookfs_Vfs;

Expand Down
Loading

0 comments on commit 071288d

Please sign in to comment.