CommIO.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
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 
9 /* DEBUG: section 05 Disk I/O pipe manager */
10 
11 #include "squid.h"
12 #include "comm/Loops.h"
13 #include "compat/pipe.h"
14 #include "compat/unistd.h"
16 #include "fd.h"
17 #include "globals.h"
18 #include "win32.h"
19 
20 void
22 {
24  return;
25 
26  /* Initialize done pipe signal */
27  int DonePipe[2];
28  if (pipe(DonePipe)) {}
29  DoneFD = DonePipe[1];
30  DoneReadFD = DonePipe[0];
31  fd_open(DoneReadFD, FD_PIPE, "async-io completion event: main");
32  fd_open(DoneFD, FD_PIPE, "async-io completion event: threads");
36  Initialized = true;
37 }
38 
39 void
41 {
42  /* Close done pipe signal */
43  FlushPipe();
44  xclose(DoneFD);
48  Initialized = false;
49 }
50 
51 bool CommIO::Initialized = false;
52 bool CommIO::DoneSignalled = false;
53 int CommIO::DoneFD = -1;
54 int CommIO::DoneReadFD = -1;
55 
56 void
58 {
59  char buf[256];
60  FD_READ_METHOD(DoneReadFD, buf, sizeof(buf));
61 }
62 
63 void
64 CommIO::NULLFDHandler(int fd, void *)
65 {
66  FlushPipe();
68 }
69 
70 void
72 {
73  if (DoneSignalled) {
74  FlushPipe();
75  DoneSignalled = false;
76  }
77 }
78 
static void FlushPipe()
Definition: CommIO.cc:57
static bool DoneSignalled
Definition: CommIO.h:29
static bool Initialized
Definition: CommIO.h:28
int commSetNonBlocking(int fd)
Definition: comm.cc:1044
static void ResetNotifications()
Definition: CommIO.cc:71
void fd_open(const int fd, unsigned int, const char *description)
Definition: minimal.cc:15
static void NotifyIOClose()
Definition: CommIO.cc:40
static int DoneReadFD
Definition: CommIO.h:31
#define COMM_SELECT_READ
Definition: defines.h:24
static int DoneFD
Definition: CommIO.h:30
int FD_READ_METHOD(int fd, char *buf, int len)
Definition: fde.h:194
void SetSelect(int, unsigned int, PF *, void *, time_t)
Mark an FD to be watched for its IO status.
Definition: ModDevPoll.cc:220
static void Initialize()
Definition: CommIO.cc:21
void fd_close(const int fd)
Definition: minimal.cc:21
@ FD_PIPE
Definition: enums.h:17
int xclose(int fd)
POSIX close(2) equivalent.
Definition: unistd.h:43
static void NULLFDHandler(int, void *)
Definition: CommIO.cc:64

 

Introduction

Documentation

Support

Miscellaneous