equal
deleted
inserted
replaced
146 // create socket pair for wakeup mechanism |
146 // create socket pair for wakeup mechanism |
147 int[] sv = new int[2]; |
147 int[] sv = new int[2]; |
148 try { |
148 try { |
149 socketpair(sv); |
149 socketpair(sv); |
150 // register one end with pollset |
150 // register one end with pollset |
151 pollsetCtl(pollset, PS_ADD, sv[0], POLLIN); |
151 pollsetCtl(pollset, PS_ADD, sv[0], Net.POLLIN); |
152 } catch (IOException x) { |
152 } catch (IOException x) { |
153 pollsetDestroy(pollset); |
153 pollsetDestroy(pollset); |
154 throw x; |
154 throw x; |
155 } |
155 } |
156 this.sp = sv; |
156 this.sp = sv; |
158 // create socket pair for pollset control mechanism |
158 // create socket pair for pollset control mechanism |
159 sv = new int[2]; |
159 sv = new int[2]; |
160 try { |
160 try { |
161 socketpair(sv); |
161 socketpair(sv); |
162 // register one end with pollset |
162 // register one end with pollset |
163 pollsetCtl(pollset, PS_ADD, sv[0], POLLIN); |
163 pollsetCtl(pollset, PS_ADD, sv[0], Net.POLLIN); |
164 } catch (IOException x) { |
164 } catch (IOException x) { |
165 pollsetDestroy(pollset); |
165 pollsetDestroy(pollset); |
166 throw x; |
166 throw x; |
167 } |
167 } |
168 this.ctlSp = sv; |
168 this.ctlSp = sv; |
351 drain1(sp[0]); |
351 drain1(sp[0]); |
352 } |
352 } |
353 |
353 |
354 // This is the only file descriptor without |
354 // This is the only file descriptor without |
355 // one shot semantic => register it again. |
355 // one shot semantic => register it again. |
356 pollsetCtl(pollset, PS_ADD, sp[0], POLLIN); |
356 pollsetCtl(pollset, PS_ADD, sp[0], Net.POLLIN); |
357 |
357 |
358 // queue special event if there are more events |
358 // queue special event if there are more events |
359 // to handle. |
359 // to handle. |
360 if (n > 0) { |
360 if (n > 0) { |
361 queue.offer(EXECUTE_TASK_OR_SHUTDOWN); |
361 queue.offer(EXECUTE_TASK_OR_SHUTDOWN); |
368 if (fd == ctlSp[0]) { |
368 if (fd == ctlSp[0]) { |
369 synchronized (controlQueue) { |
369 synchronized (controlQueue) { |
370 drain1(ctlSp[0]); |
370 drain1(ctlSp[0]); |
371 // This file descriptor does not have |
371 // This file descriptor does not have |
372 // one shot semantic => register it again. |
372 // one shot semantic => register it again. |
373 pollsetCtl(pollset, PS_ADD, ctlSp[0], POLLIN); |
373 pollsetCtl(pollset, PS_ADD, ctlSp[0], Net.POLLIN); |
374 processControlQueue(); |
374 processControlQueue(); |
375 } |
375 } |
376 continue; |
376 continue; |
377 } |
377 } |
378 |
378 |