]> git.ipfire.org Git - thirdparty/squid.git/blob - src/DiskIO/DiskThreads/CommIO.h
Bug 3189: AIO thread race on pipe() initialization
[thirdparty/squid.git] / src / DiskIO / DiskThreads / CommIO.h
1 #ifndef SQUID_SRC_DISKIO_DISKTHREADS_COMMIO_H
2 #define SQUID_SRC_DISKIO_DISKTHREADS_COMMIO_H
3
4 #include "fde.h"
5 #include "globals.h"
6
7 class CommIO
8 {
9
10 public:
11 static inline void NotifyIOCompleted();
12 static void ResetNotifications();
13 static void Initialise();
14 static void NotifyIOClose();
15
16 private:
17 static void NULLFDHandler(int, void *);
18 static void FlushPipe();
19 static bool Initialised;
20 static bool DoneSignalled;
21 static int DoneFD;
22 static int DoneReadFD;
23 };
24
25 /* Inline code. TODO: make structured approach to inlining */
26 void
27 CommIO::NotifyIOCompleted()
28 {
29 if (!Initialised) {
30 fatalf("Disk Threads I/O pipes not initialized before first use.");
31 }
32
33 if (!DoneSignalled) {
34 DoneSignalled = true;
35 FD_WRITE_METHOD(DoneFD, "!", 1);
36 }
37 };
38
39 #endif /* SQUID_SRC_DISKIO_DISKTHREADS_COMMIO_H */