ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev_linuxaio.c
(Generate patch)

Comparing libev/ev_linuxaio.c (file contents):
Revision 1.11 by root, Sun Jun 23 22:57:25 2019 UTC vs.
Revision 1.12 by root, Sun Jun 23 23:02:09 2019 UTC

231 if (ecb_expect_false (ring->magic != AIO_RING_MAGIC) 231 if (ecb_expect_false (ring->magic != AIO_RING_MAGIC)
232 || ring->incompat_features != AIO_RING_INCOMPAT_FEATURES 232 || ring->incompat_features != AIO_RING_INCOMPAT_FEATURES
233 || ring->header_length != sizeof (struct aio_ring)) /* TODO: or use it to find io_event[0]? */ 233 || ring->header_length != sizeof (struct aio_ring)) /* TODO: or use it to find io_event[0]? */
234 return 0; 234 return 0;
235 235
236 /* make sure the events up to tail are visible */
236 ECB_MEMORY_FENCE_ACQUIRE; 237 ECB_MEMORY_FENCE_ACQUIRE;
237 238
238 /* parse all available events, but only once, to avoid starvation */ 239 /* parse all available events, but only once, to avoid starvation */
239 if (tail > head) /* normal case around */ 240 if (tail > head) /* normal case around */
240 linuxaio_parse_events (EV_A_ ring->io_events + head, tail - head); 241 linuxaio_parse_events (EV_A_ ring->io_events + head, tail - head);
243 linuxaio_parse_events (EV_A_ ring->io_events + head, ring->nr - head); 244 linuxaio_parse_events (EV_A_ ring->io_events + head, ring->nr - head);
244 linuxaio_parse_events (EV_A_ ring->io_events, tail); 245 linuxaio_parse_events (EV_A_ ring->io_events, tail);
245 } 246 }
246 247
247 *(volatile unsigned *)&ring->head = tail; 248 *(volatile unsigned *)&ring->head = tail;
248 249 /* make sure kernel can see our new head value - probably not required */
249 /* again, other implementations don't do this, but I think it's required for the kernel to see free slots */
250 ECB_MEMORY_FENCE_RELEASE; 250 ECB_MEMORY_FENCE_RELEASE;
251 251
252 return 1; 252 return 1;
253} 253}
254 254

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines