summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtchang%redhat.com <devnull@localhost>2005-04-28 22:37:25 +0000
committerwtchang%redhat.com <devnull@localhost>2005-04-28 22:37:25 +0000
commit493169d0c06b629f83118b1e69909c91f0e65f35 (patch)
tree11bf498df55571ab344a5dad2a9df41871862c95
parent1ec70e932a009e881af37a75c6915339438d879e (diff)
downloadnspr-hg-493169d0c06b629f83118b1e69909c91f0e65f35.tar.gz
Bugzilla Bug 291982: fixed a bug when we remove an item from a list
while iterating through the list. The bug was reported and tracked down by kamil@good.com.
-rw-r--r--pr/src/misc/prtpool.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pr/src/misc/prtpool.c b/pr/src/misc/prtpool.c
index fbedd7de..e23bb9d0 100644
--- a/pr/src/misc/prtpool.c
+++ b/pr/src/misc/prtpool.c
@@ -312,7 +312,7 @@ static void io_wstart(void *arg)
PRThreadPool *tp = (PRThreadPool *) arg;
int pollfd_cnt, pollfds_used;
int rv;
-PRCList *qp;
+PRCList *qp, *nextqp;
PRPollDesc *pollfds;
PRJob **polljobs;
int poll_timeout;
@@ -365,7 +365,8 @@ PRIntervalTime now;
* fill in the pollfd array
*/
PR_Lock(tp->ioq.lock);
- for (qp = tp->ioq.list.next; qp != &tp->ioq.list; qp = qp->next) {
+ for (qp = tp->ioq.list.next; qp != &tp->ioq.list; qp = nextqp) {
+ nextqp = qp->next;
jobp = JOB_LINKS_PTR(qp);
if (jobp->cancel_io) {
CANCEL_IO_JOB(jobp);
@@ -489,7 +490,8 @@ PRIntervalTime now;
*/
now = PR_IntervalNow();
PR_Lock(tp->ioq.lock);
- for (qp = tp->ioq.list.next; qp != &tp->ioq.list; qp = qp->next) {
+ for (qp = tp->ioq.list.next; qp != &tp->ioq.list; qp = nextqp) {
+ nextqp = qp->next;
jobp = JOB_LINKS_PTR(qp);
if (jobp->cancel_io) {
CANCEL_IO_JOB(jobp);