]> git.ipfire.org Git - thirdparty/squid.git/blame - src/DiskIO/DiskThreads/CommIO.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / DiskIO / DiskThreads / CommIO.h
CommitLineData
bbc27441 1/*
4ac4a490 2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
bbc27441
AJ
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
1ff991dc
AJ
9#ifndef SQUID_SRC_DISKIO_DISKTHREADS_COMMIO_H
10#define SQUID_SRC_DISKIO_DISKTHREADS_COMMIO_H
56410c89 11
ed6e9fb9 12#include "fatal.h"
56410c89 13#include "fde.h"
582c2af2 14#include "globals.h"
56410c89 15
16class CommIO
17{
18
19public:
20 static inline void NotifyIOCompleted();
21 static void ResetNotifications();
1564ff62 22 static void Initialize();
56410c89 23 static void NotifyIOClose();
24
25private:
26 static void NULLFDHandler(int, void *);
27 static void FlushPipe();
1564ff62 28 static bool Initialized;
56410c89 29 static bool DoneSignalled;
30 static int DoneFD;
31 static int DoneReadFD;
32};
33
45bb0381 34/* Inline code. TODO: make structured approach to inlining */
56410c89 35void
36CommIO::NotifyIOCompleted()
37{
1564ff62 38 if (!Initialized) {
45bb0381
AJ
39 fatalf("Disk Threads I/O pipes not initialized before first use.");
40 }
56410c89 41
42 if (!DoneSignalled) {
43 DoneSignalled = true;
44 FD_WRITE_METHOD(DoneFD, "!", 1);
45 }
46};
47
1ff991dc 48#endif /* SQUID_SRC_DISKIO_DISKTHREADS_COMMIO_H */
f53969cc 49