~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/DiskIO/DiskThreads/aiops_win32.cc

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2010-05-04 11:15:49 UTC
  • mfrom: (1.3.1 upstream)
  • mto: (20.3.1 squeeze) (21.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20100504111549-1apjh2g5sndki4te
Tags: upstream-3.1.3
ImportĀ upstreamĀ versionĀ 3.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: aiops_win32.cc,v 1.5 2007/08/16 23:32:28 hno Exp $
 
2
 * $Id$
3
3
 *
4
4
 * DEBUG: section 43    Windows AIOPS
5
5
 * AUTHOR: Stewart Forster <slf@connect.com.au>
22
22
 *  it under the terms of the GNU General Public License as published by
23
23
 *  the Free Software Foundation; either version 2 of the License, or
24
24
 *  (at your option) any later version.
25
 
 *  
 
25
 *
26
26
 *  This program is distributed in the hope that it will be useful,
27
27
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
28
28
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
29
 *  GNU General Public License for more details.
30
 
 *  
 
30
 *
31
31
 *  You should have received a copy of the GNU General Public License
32
32
 *  along with this program; if not, write to the Free Software
33
33
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
60
60
};
61
61
typedef enum _squidaio_thread_status squidaio_thread_status;
62
62
 
63
 
typedef struct squidaio_request_t
64
 
{
 
63
typedef struct squidaio_request_t {
65
64
 
66
65
    struct squidaio_request_t *next;
67
66
    squidaio_request_type request_type;
82
81
 
83
82
    struct stat *statp;
84
83
    squidaio_result_t *resultp;
85
 
}
86
 
 
87
 
squidaio_request_t;
88
 
 
89
 
typedef struct squidaio_request_queue_t
90
 
{
 
84
} squidaio_request_t;
 
85
 
 
86
typedef struct squidaio_request_queue_t {
91
87
    HANDLE mutex;
92
88
    HANDLE cond; /* See Event objects */
93
89
    squidaio_request_t *volatile head;
94
90
    squidaio_request_t *volatile *volatile tailp;
95
91
    unsigned long requests;
96
92
    unsigned long blocked;      /* main failed to lock the queue */
97
 
}
98
 
 
99
 
squidaio_request_queue_t;
 
93
} squidaio_request_queue_t;
100
94
 
101
95
typedef struct squidaio_thread_t squidaio_thread_t;
102
96
 
103
 
struct squidaio_thread_t
104
 
{
 
97
struct squidaio_thread_t {
105
98
    squidaio_thread_t *next;
106
99
    HANDLE thread;
107
100
    DWORD dwThreadId; /* thread ID */
148
141
static MemAllocator *squidaio_thread_pool = NULL;
149
142
static squidaio_request_queue_t request_queue;
150
143
 
151
 
static struct
152
 
{
 
144
static struct {
153
145
    squidaio_request_t *head, **tailp;
154
146
}
155
147
 
156
148
request_queue2 = {
157
149
 
158
 
                     NULL, &request_queue2.head
159
 
                 };
 
150
    NULL, &request_queue2.head
 
151
};
160
152
static squidaio_request_queue_t done_queue;
161
153
 
162
 
static struct
163
 
{
 
154
static struct {
164
155
    squidaio_request_t *head, **tailp;
165
156
}
166
157
 
167
158
done_requests = {
168
159
 
169
 
                    NULL, &done_requests.head
170
 
                };
 
160
    NULL, &done_requests.head
 
161
};
171
162
 
172
163
static HANDLE main_thread;
173
164
 
903
894
static void
904
895
squidaio_do_close(squidaio_request_t * requestp)
905
896
{
906
 
    if((requestp->ret = close(requestp->fd)) < 0) {
 
897
    if ((requestp->ret = close(requestp->fd)) < 0) {
907
898
        debugs(43, 0, "squidaio_do_close: FD " << requestp->fd << ", errno " << errno);
908
899
        close(requestp->fd);
909
900
    }