CommIO.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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"
14 #include "fd.h"
15 #include "globals.h"
16 #include "win32.h"
17 
18 void
20 {
22  return;
23 
24  /* Initialize done pipe signal */
25  int DonePipe[2];
26  if (pipe(DonePipe)) {}
27  DoneFD = DonePipe[1];
28  DoneReadFD = DonePipe[0];
29  fd_open(DoneReadFD, FD_PIPE, "async-io completion event: main");
30  fd_open(DoneFD, FD_PIPE, "async-io completion event: threads");
34  Initialized = true;
35 }
36 
37 void
39 {
40  /* Close done pipe signal */
41  FlushPipe();
42  close(DoneFD);
43  close(DoneReadFD);
46  Initialized = false;
47 }
48 
49 bool CommIO::Initialized = false;
50 bool CommIO::DoneSignalled = false;
51 int CommIO::DoneFD = -1;
52 int CommIO::DoneReadFD = -1;
53 
54 void
56 {
57  char buf[256];
58  FD_READ_METHOD(DoneReadFD, buf, sizeof(buf));
59 }
60 
61 void
62 CommIO::NULLFDHandler(int fd, void *)
63 {
64  FlushPipe();
66 }
67 
68 void
70 {
71  if (DoneSignalled) {
72  FlushPipe();
73  DoneSignalled = false;
74  }
75 }
76 
static void ResetNotifications()
Definition: CommIO.cc:69
static bool DoneSignalled
Definition: CommIO.h:29
#define COMM_SELECT_READ
Definition: defines.h:36
static bool Initialized
Definition: CommIO.h:28
static void NULLFDHandler(int, void *)
Definition: CommIO.cc:62
void fd_open(int fd, unsigned int type, const char *desc)
Definition: fd.cc:187
static int DoneReadFD
Definition: CommIO.h:31
static void NotifyIOClose()
Definition: CommIO.cc:38
static int DoneFD
Definition: CommIO.h:30
void SetSelect(int, unsigned int, PF *, void *, time_t)
Mark an FD to be watched for its IO status.
Definition: ModDevPoll.cc:225
int commSetNonBlocking(int fd)
Definition: comm.cc:1076
void fd_close(int fd)
Definition: fd.cc:82
static void Initialize()
Definition: CommIO.cc:19
void const char * buf
Definition: stub_helper.cc:16
Definition: enums.h:17
#define FD_READ_METHOD(fd, buf, len)
Definition: fde.h:161
static void FlushPipe()
Definition: CommIO.cc:55
#define NULL
Definition: types.h:166

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors