OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 #include "nspr.h" | 6 #include "nspr.h" |
7 | 7 |
8 /* | 8 /* |
9 * Thread pools | 9 * Thread pools |
10 * Thread pools create and manage threads to provide support for | 10 * Thread pools create and manage threads to provide support for |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 /* | 275 /* |
276 * io worker thread function | 276 * io worker thread function |
277 */ | 277 */ |
278 static void io_wstart(void *arg) | 278 static void io_wstart(void *arg) |
279 { | 279 { |
280 PRThreadPool *tp = (PRThreadPool *) arg; | 280 PRThreadPool *tp = (PRThreadPool *) arg; |
281 int pollfd_cnt, pollfds_used; | 281 int pollfd_cnt, pollfds_used; |
282 int rv; | 282 int rv; |
283 PRCList *qp, *nextqp; | 283 PRCList *qp, *nextqp; |
284 PRPollDesc *pollfds; | 284 PRPollDesc *pollfds = NULL; |
285 PRJob **polljobs; | 285 PRJob **polljobs = NULL; |
286 int poll_timeout; | 286 int poll_timeout; |
287 PRIntervalTime now; | 287 PRIntervalTime now; |
288 | 288 |
289 /* | 289 /* |
290 * scan io_jobq | 290 * scan io_jobq |
291 * construct poll list | 291 * construct poll list |
292 * call PR_Poll | 292 * call PR_Poll |
293 * for all fds, for which poll returns true, move the job to | 293 * for all fds, for which poll returns true, move the job to |
294 * jobq and wakeup worker thread. | 294 * jobq and wakeup worker thread. |
295 */ | 295 */ |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 delete_job(jobp); | 1178 delete_job(jobp); |
1179 } | 1179 } |
1180 | 1180 |
1181 PR_ASSERT(0 == tpool->jobq.cnt); | 1181 PR_ASSERT(0 == tpool->jobq.cnt); |
1182 PR_ASSERT(0 == tpool->ioq.cnt); | 1182 PR_ASSERT(0 == tpool->ioq.cnt); |
1183 PR_ASSERT(0 == tpool->timerq.cnt); | 1183 PR_ASSERT(0 == tpool->timerq.cnt); |
1184 | 1184 |
1185 delete_threadpool(tpool); | 1185 delete_threadpool(tpool); |
1186 return rval; | 1186 return rval; |
1187 } | 1187 } |
OLD | NEW |