Lines Matching refs:ctx

43 static void kill_timeout(struct epoll_mtcontext *ctx)  in kill_timeout()  argument
46 pthread_kill(ctx->main, SIGUSR1); in kill_timeout()
47 pthread_kill(ctx->waiter, SIGUSR1); in kill_timeout()
53 struct epoll_mtcontext *ctx = data; in waiter_entry1a() local
55 if (epoll_wait(ctx->efd[0], &e, 1, -1) > 0) in waiter_entry1a()
56 __sync_fetch_and_add(&ctx->count, 1); in waiter_entry1a()
65 struct epoll_mtcontext *ctx = data; in waiter_entry1ap() local
67 pfd.fd = ctx->efd[0]; in waiter_entry1ap()
70 if (epoll_wait(ctx->efd[0], &e, 1, 0) > 0) in waiter_entry1ap()
71 __sync_fetch_and_add(&ctx->count, 1); in waiter_entry1ap()
80 struct epoll_mtcontext *ctx = data; in waiter_entry1o() local
82 if (epoll_wait(ctx->efd[0], &e, 1, -1) > 0) in waiter_entry1o()
83 __sync_fetch_and_or(&ctx->count, 1); in waiter_entry1o()
92 struct epoll_mtcontext *ctx = data; in waiter_entry1op() local
94 pfd.fd = ctx->efd[0]; in waiter_entry1op()
97 if (epoll_wait(ctx->efd[0], &e, 1, 0) > 0) in waiter_entry1op()
98 __sync_fetch_and_or(&ctx->count, 1); in waiter_entry1op()
107 struct epoll_mtcontext *ctx = data; in waiter_entry2a() local
109 if (epoll_wait(ctx->efd[0], events, 2, -1) > 0) in waiter_entry2a()
110 __sync_fetch_and_add(&ctx->count, 1); in waiter_entry2a()
119 struct epoll_mtcontext *ctx = data; in waiter_entry2ap() local
121 pfd.fd = ctx->efd[0]; in waiter_entry2ap()
124 if (epoll_wait(ctx->efd[0], events, 2, 0) > 0) in waiter_entry2ap()
125 __sync_fetch_and_add(&ctx->count, 1); in waiter_entry2ap()
133 struct epoll_mtcontext *ctx = data; in emitter_entry1() local
136 write(ctx->sfd[1], "w", 1); in emitter_entry1()
138 kill_timeout(ctx); in emitter_entry1()
145 struct epoll_mtcontext *ctx = data; in emitter_entry2() local
148 write(ctx->sfd[1], "w", 1); in emitter_entry2()
149 write(ctx->sfd[3], "w", 1); in emitter_entry2()
151 kill_timeout(ctx); in emitter_entry2()
476 struct epoll_mtcontext ctx = { 0 }; in TEST() local
480 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
482 ctx.efd[0] = epoll_create(1); in TEST()
483 ASSERT_GE(ctx.efd[0], 0); in TEST()
486 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
488 ctx.main = pthread_self(); in TEST()
489 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
490 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
492 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
493 __sync_fetch_and_add(&ctx.count, 1); in TEST()
495 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
496 EXPECT_EQ(ctx.count, 2); in TEST()
503 close(ctx.efd[0]); in TEST()
504 close(ctx.sfd[0]); in TEST()
505 close(ctx.sfd[1]); in TEST()
519 struct epoll_mtcontext ctx = { 0 }; in TEST() local
523 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
525 ctx.efd[0] = epoll_create(1); in TEST()
526 ASSERT_GE(ctx.efd[0], 0); in TEST()
529 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
531 ctx.main = pthread_self(); in TEST()
532 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
533 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
535 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
536 __sync_fetch_and_add(&ctx.count, 1); in TEST()
538 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
539 EXPECT_EQ(ctx.count, 1); in TEST()
546 close(ctx.efd[0]); in TEST()
547 close(ctx.sfd[0]); in TEST()
548 close(ctx.sfd[1]); in TEST()
562 struct epoll_mtcontext ctx = { 0 }; in TEST() local
566 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
567 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
569 ctx.efd[0] = epoll_create(1); in TEST()
570 ASSERT_GE(ctx.efd[0], 0); in TEST()
573 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], events), 0); in TEST()
576 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[2], events), 0); in TEST()
578 ctx.main = pthread_self(); in TEST()
579 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry2a, &ctx), 0); in TEST()
580 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
582 if (epoll_wait(ctx.efd[0], events, 2, -1) > 0) in TEST()
583 __sync_fetch_and_add(&ctx.count, 1); in TEST()
585 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
586 EXPECT_EQ(ctx.count, 2); in TEST()
593 close(ctx.efd[0]); in TEST()
594 close(ctx.sfd[0]); in TEST()
595 close(ctx.sfd[1]); in TEST()
596 close(ctx.sfd[2]); in TEST()
597 close(ctx.sfd[3]); in TEST()
611 struct epoll_mtcontext ctx = { 0 }; in TEST() local
615 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
616 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
618 ctx.efd[0] = epoll_create(1); in TEST()
619 ASSERT_GE(ctx.efd[0], 0); in TEST()
622 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], events), 0); in TEST()
625 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[2], events), 0); in TEST()
627 ctx.main = pthread_self(); in TEST()
628 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
629 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
631 if (epoll_wait(ctx.efd[0], events, 1, -1) > 0) in TEST()
632 __sync_fetch_and_add(&ctx.count, 1); in TEST()
634 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
635 EXPECT_EQ(ctx.count, 2); in TEST()
642 close(ctx.efd[0]); in TEST()
643 close(ctx.sfd[0]); in TEST()
644 close(ctx.sfd[1]); in TEST()
645 close(ctx.sfd[2]); in TEST()
646 close(ctx.sfd[3]); in TEST()
660 struct epoll_mtcontext ctx = { 0 }; in TEST() local
664 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
666 ctx.efd[0] = epoll_create(1); in TEST()
667 ASSERT_GE(ctx.efd[0], 0); in TEST()
670 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
672 ctx.main = pthread_self(); in TEST()
673 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
674 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
676 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
677 __sync_fetch_and_add(&ctx.count, 1); in TEST()
679 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
680 EXPECT_EQ(ctx.count, 2); in TEST()
687 close(ctx.efd[0]); in TEST()
688 close(ctx.sfd[0]); in TEST()
689 close(ctx.sfd[1]); in TEST()
703 struct epoll_mtcontext ctx = { 0 }; in TEST() local
707 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
709 ctx.efd[0] = epoll_create(1); in TEST()
710 ASSERT_GE(ctx.efd[0], 0); in TEST()
713 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
715 ctx.main = pthread_self(); in TEST()
716 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
717 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
719 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
720 __sync_fetch_and_add(&ctx.count, 1); in TEST()
722 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
723 EXPECT_EQ(ctx.count, 1); in TEST()
730 close(ctx.efd[0]); in TEST()
731 close(ctx.sfd[0]); in TEST()
732 close(ctx.sfd[1]); in TEST()
746 struct epoll_mtcontext ctx = { 0 }; in TEST() local
750 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
751 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
753 ctx.efd[0] = epoll_create(1); in TEST()
754 ASSERT_GE(ctx.efd[0], 0); in TEST()
757 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], events), 0); in TEST()
760 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[2], events), 0); in TEST()
762 ctx.main = pthread_self(); in TEST()
763 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry2ap, &ctx), 0); in TEST()
764 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
766 if (epoll_wait(ctx.efd[0], events, 2, -1) > 0) in TEST()
767 __sync_fetch_and_add(&ctx.count, 1); in TEST()
769 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
770 EXPECT_EQ(ctx.count, 2); in TEST()
777 close(ctx.efd[0]); in TEST()
778 close(ctx.sfd[0]); in TEST()
779 close(ctx.sfd[1]); in TEST()
780 close(ctx.sfd[2]); in TEST()
781 close(ctx.sfd[3]); in TEST()
795 struct epoll_mtcontext ctx = { 0 }; in TEST() local
799 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
800 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
802 ctx.efd[0] = epoll_create(1); in TEST()
803 ASSERT_GE(ctx.efd[0], 0); in TEST()
806 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], events), 0); in TEST()
809 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[2], events), 0); in TEST()
811 ctx.main = pthread_self(); in TEST()
812 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
813 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
815 if (epoll_wait(ctx.efd[0], events, 1, -1) > 0) in TEST()
816 __sync_fetch_and_add(&ctx.count, 1); in TEST()
818 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
819 EXPECT_EQ(ctx.count, 2); in TEST()
826 close(ctx.efd[0]); in TEST()
827 close(ctx.sfd[0]); in TEST()
828 close(ctx.sfd[1]); in TEST()
829 close(ctx.sfd[2]); in TEST()
830 close(ctx.sfd[3]); in TEST()
1198 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1202 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1204 ctx.efd[0] = epoll_create(1); in TEST()
1205 ASSERT_GE(ctx.efd[0], 0); in TEST()
1207 ctx.efd[1] = epoll_create(1); in TEST()
1208 ASSERT_GE(ctx.efd[1], 0); in TEST()
1211 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1214 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1216 ctx.main = pthread_self(); in TEST()
1217 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1218 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1220 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1221 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1223 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1224 EXPECT_EQ(ctx.count, 2); in TEST()
1231 close(ctx.efd[0]); in TEST()
1232 close(ctx.efd[1]); in TEST()
1233 close(ctx.sfd[0]); in TEST()
1234 close(ctx.sfd[1]); in TEST()
1250 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1254 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1256 ctx.efd[0] = epoll_create(1); in TEST()
1257 ASSERT_GE(ctx.efd[0], 0); in TEST()
1259 ctx.efd[1] = epoll_create(1); in TEST()
1260 ASSERT_GE(ctx.efd[1], 0); in TEST()
1263 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1266 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1268 ctx.main = pthread_self(); in TEST()
1269 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1270 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1272 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1273 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1275 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1276 EXPECT_EQ(ctx.count, 2); in TEST()
1283 close(ctx.efd[0]); in TEST()
1284 close(ctx.efd[1]); in TEST()
1285 close(ctx.sfd[0]); in TEST()
1286 close(ctx.sfd[1]); in TEST()
1302 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1306 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1308 ctx.efd[0] = epoll_create(1); in TEST()
1309 ASSERT_GE(ctx.efd[0], 0); in TEST()
1311 ctx.efd[1] = epoll_create(1); in TEST()
1312 ASSERT_GE(ctx.efd[1], 0); in TEST()
1315 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1318 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1320 ctx.main = pthread_self(); in TEST()
1321 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1322 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1324 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1325 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1327 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1328 EXPECT_EQ(ctx.count, 1); in TEST()
1335 close(ctx.efd[0]); in TEST()
1336 close(ctx.efd[1]); in TEST()
1337 close(ctx.sfd[0]); in TEST()
1338 close(ctx.sfd[1]); in TEST()
1354 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1358 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1360 ctx.efd[0] = epoll_create(1); in TEST()
1361 ASSERT_GE(ctx.efd[0], 0); in TEST()
1363 ctx.efd[1] = epoll_create(1); in TEST()
1364 ASSERT_GE(ctx.efd[1], 0); in TEST()
1367 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1370 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1372 ctx.main = pthread_self(); in TEST()
1373 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1374 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1376 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1377 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1379 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1380 EXPECT_EQ(ctx.count, 1); in TEST()
1387 close(ctx.efd[0]); in TEST()
1388 close(ctx.efd[1]); in TEST()
1389 close(ctx.sfd[0]); in TEST()
1390 close(ctx.sfd[1]); in TEST()
1406 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1410 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1412 ctx.efd[0] = epoll_create(1); in TEST()
1413 ASSERT_GE(ctx.efd[0], 0); in TEST()
1415 ctx.efd[1] = epoll_create(1); in TEST()
1416 ASSERT_GE(ctx.efd[1], 0); in TEST()
1419 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1422 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1424 ctx.main = pthread_self(); in TEST()
1425 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
1426 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1428 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1429 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1431 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1432 EXPECT_EQ(ctx.count, 2); in TEST()
1439 close(ctx.efd[0]); in TEST()
1440 close(ctx.sfd[0]); in TEST()
1441 close(ctx.sfd[1]); in TEST()
1457 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1461 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1463 ctx.efd[0] = epoll_create(1); in TEST()
1464 ASSERT_GE(ctx.efd[0], 0); in TEST()
1466 ctx.efd[1] = epoll_create(1); in TEST()
1467 ASSERT_GE(ctx.efd[1], 0); in TEST()
1470 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1473 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1475 ctx.main = pthread_self(); in TEST()
1476 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
1477 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1479 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1480 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1482 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1483 EXPECT_EQ(ctx.count, 2); in TEST()
1490 close(ctx.efd[0]); in TEST()
1491 close(ctx.sfd[0]); in TEST()
1492 close(ctx.sfd[1]); in TEST()
1508 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1512 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1514 ctx.efd[0] = epoll_create(1); in TEST()
1515 ASSERT_GE(ctx.efd[0], 0); in TEST()
1517 ctx.efd[1] = epoll_create(1); in TEST()
1518 ASSERT_GE(ctx.efd[1], 0); in TEST()
1521 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1524 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1526 ctx.main = pthread_self(); in TEST()
1527 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
1528 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1530 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1531 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1533 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1534 EXPECT_EQ(ctx.count, 1); in TEST()
1541 close(ctx.efd[0]); in TEST()
1542 close(ctx.sfd[0]); in TEST()
1543 close(ctx.sfd[1]); in TEST()
1559 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1563 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1565 ctx.efd[0] = epoll_create(1); in TEST()
1566 ASSERT_GE(ctx.efd[0], 0); in TEST()
1568 ctx.efd[1] = epoll_create(1); in TEST()
1569 ASSERT_GE(ctx.efd[1], 0); in TEST()
1572 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1575 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1577 ctx.main = pthread_self(); in TEST()
1578 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
1579 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1581 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1582 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1584 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1585 EXPECT_EQ(ctx.count, 1); in TEST()
1592 close(ctx.efd[0]); in TEST()
1593 close(ctx.sfd[0]); in TEST()
1594 close(ctx.sfd[1]); in TEST()
1610 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1614 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1616 ctx.efd[0] = epoll_create(1); in TEST()
1617 ASSERT_GE(ctx.efd[0], 0); in TEST()
1619 ctx.efd[1] = epoll_create(1); in TEST()
1620 ASSERT_GE(ctx.efd[1], 0); in TEST()
1623 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1626 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1628 ctx.main = pthread_self(); in TEST()
1629 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1630 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1632 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1633 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1635 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1636 EXPECT_EQ(ctx.count, 2); in TEST()
1643 close(ctx.efd[0]); in TEST()
1644 close(ctx.efd[1]); in TEST()
1645 close(ctx.sfd[0]); in TEST()
1646 close(ctx.sfd[1]); in TEST()
1662 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1666 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1668 ctx.efd[0] = epoll_create(1); in TEST()
1669 ASSERT_GE(ctx.efd[0], 0); in TEST()
1671 ctx.efd[1] = epoll_create(1); in TEST()
1672 ASSERT_GE(ctx.efd[1], 0); in TEST()
1675 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1678 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1680 ctx.main = pthread_self(); in TEST()
1681 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1o, &ctx), 0); in TEST()
1682 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1684 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1685 __sync_fetch_and_or(&ctx.count, 2); in TEST()
1687 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1688 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST()
1695 close(ctx.efd[0]); in TEST()
1696 close(ctx.efd[1]); in TEST()
1697 close(ctx.sfd[0]); in TEST()
1698 close(ctx.sfd[1]); in TEST()
1714 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1718 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1720 ctx.efd[0] = epoll_create(1); in TEST()
1721 ASSERT_GE(ctx.efd[0], 0); in TEST()
1723 ctx.efd[1] = epoll_create(1); in TEST()
1724 ASSERT_GE(ctx.efd[1], 0); in TEST()
1727 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1730 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1732 ctx.main = pthread_self(); in TEST()
1733 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1734 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1736 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1737 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1739 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1740 EXPECT_EQ(ctx.count, 2); in TEST()
1747 close(ctx.efd[0]); in TEST()
1748 close(ctx.efd[1]); in TEST()
1749 close(ctx.sfd[0]); in TEST()
1750 close(ctx.sfd[1]); in TEST()
1766 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1770 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1772 ctx.efd[0] = epoll_create(1); in TEST()
1773 ASSERT_GE(ctx.efd[0], 0); in TEST()
1775 ctx.efd[1] = epoll_create(1); in TEST()
1776 ASSERT_GE(ctx.efd[1], 0); in TEST()
1779 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1782 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1784 ctx.main = pthread_self(); in TEST()
1785 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1o, &ctx), 0); in TEST()
1786 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1788 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1789 __sync_fetch_and_or(&ctx.count, 2); in TEST()
1791 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1792 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST()
1799 close(ctx.efd[0]); in TEST()
1800 close(ctx.efd[1]); in TEST()
1801 close(ctx.sfd[0]); in TEST()
1802 close(ctx.sfd[1]); in TEST()
1819 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1823 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1825 ctx.efd[0] = epoll_create(1); in TEST()
1826 ASSERT_GE(ctx.efd[0], 0); in TEST()
1828 ctx.efd[1] = epoll_create(1); in TEST()
1829 ASSERT_GE(ctx.efd[1], 0); in TEST()
1832 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1835 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1837 ctx.main = pthread_self(); in TEST()
1838 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1839 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1841 pfd.fd = ctx.efd[1]; in TEST()
1844 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
1845 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1848 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1849 EXPECT_EQ(ctx.count, 2); in TEST()
1856 close(ctx.efd[0]); in TEST()
1857 close(ctx.efd[1]); in TEST()
1858 close(ctx.sfd[0]); in TEST()
1859 close(ctx.sfd[1]); in TEST()
1876 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1880 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1882 ctx.efd[0] = epoll_create(1); in TEST()
1883 ASSERT_GE(ctx.efd[0], 0); in TEST()
1885 ctx.efd[1] = epoll_create(1); in TEST()
1886 ASSERT_GE(ctx.efd[1], 0); in TEST()
1889 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1892 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1894 ctx.main = pthread_self(); in TEST()
1895 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1o, &ctx), 0); in TEST()
1896 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1898 pfd.fd = ctx.efd[1]; in TEST()
1901 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
1902 __sync_fetch_and_or(&ctx.count, 2); in TEST()
1905 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1906 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST()
1913 close(ctx.efd[0]); in TEST()
1914 close(ctx.efd[1]); in TEST()
1915 close(ctx.sfd[0]); in TEST()
1916 close(ctx.sfd[1]); in TEST()
1933 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1937 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1939 ctx.efd[0] = epoll_create(1); in TEST()
1940 ASSERT_GE(ctx.efd[0], 0); in TEST()
1942 ctx.efd[1] = epoll_create(1); in TEST()
1943 ASSERT_GE(ctx.efd[1], 0); in TEST()
1946 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1949 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1951 ctx.main = pthread_self(); in TEST()
1952 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1953 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1955 pfd.fd = ctx.efd[1]; in TEST()
1958 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
1959 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1962 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1963 EXPECT_EQ(ctx.count, 2); in TEST()
1970 close(ctx.efd[0]); in TEST()
1971 close(ctx.efd[1]); in TEST()
1972 close(ctx.sfd[0]); in TEST()
1973 close(ctx.sfd[1]); in TEST()
1990 struct epoll_mtcontext ctx = { 0 }; in TEST() local
1994 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1996 ctx.efd[0] = epoll_create(1); in TEST()
1997 ASSERT_GE(ctx.efd[0], 0); in TEST()
1999 ctx.efd[1] = epoll_create(1); in TEST()
2000 ASSERT_GE(ctx.efd[1], 0); in TEST()
2003 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2006 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2008 ctx.main = pthread_self(); in TEST()
2009 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1o, &ctx), 0); in TEST()
2010 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2012 pfd.fd = ctx.efd[1]; in TEST()
2015 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
2016 __sync_fetch_and_or(&ctx.count, 2); in TEST()
2019 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2020 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST()
2027 close(ctx.efd[0]); in TEST()
2028 close(ctx.efd[1]); in TEST()
2029 close(ctx.sfd[0]); in TEST()
2030 close(ctx.sfd[1]); in TEST()
2046 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2050 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2052 ctx.efd[0] = epoll_create(1); in TEST()
2053 ASSERT_GE(ctx.efd[0], 0); in TEST()
2055 ctx.efd[1] = epoll_create(1); in TEST()
2056 ASSERT_GE(ctx.efd[1], 0); in TEST()
2059 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2062 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2064 ctx.main = pthread_self(); in TEST()
2065 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2066 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2068 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2069 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2071 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2072 EXPECT_EQ(ctx.count, 2); in TEST()
2079 close(ctx.efd[0]); in TEST()
2080 close(ctx.efd[1]); in TEST()
2081 close(ctx.sfd[0]); in TEST()
2082 close(ctx.sfd[1]); in TEST()
2098 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2102 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2104 ctx.efd[0] = epoll_create(1); in TEST()
2105 ASSERT_GE(ctx.efd[0], 0); in TEST()
2107 ctx.efd[1] = epoll_create(1); in TEST()
2108 ASSERT_GE(ctx.efd[1], 0); in TEST()
2111 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2114 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2116 ctx.main = pthread_self(); in TEST()
2117 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1op, &ctx), 0); in TEST()
2118 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2120 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2121 __sync_fetch_and_or(&ctx.count, 2); in TEST()
2123 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2124 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST()
2131 close(ctx.efd[0]); in TEST()
2132 close(ctx.efd[1]); in TEST()
2133 close(ctx.sfd[0]); in TEST()
2134 close(ctx.sfd[1]); in TEST()
2150 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2154 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2156 ctx.efd[0] = epoll_create(1); in TEST()
2157 ASSERT_GE(ctx.efd[0], 0); in TEST()
2159 ctx.efd[1] = epoll_create(1); in TEST()
2160 ASSERT_GE(ctx.efd[1], 0); in TEST()
2163 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2166 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2168 ctx.main = pthread_self(); in TEST()
2169 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2170 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2172 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2173 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2175 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2176 EXPECT_EQ(ctx.count, 2); in TEST()
2183 close(ctx.efd[0]); in TEST()
2184 close(ctx.efd[1]); in TEST()
2185 close(ctx.sfd[0]); in TEST()
2186 close(ctx.sfd[1]); in TEST()
2202 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2206 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2208 ctx.efd[0] = epoll_create(1); in TEST()
2209 ASSERT_GE(ctx.efd[0], 0); in TEST()
2211 ctx.efd[1] = epoll_create(1); in TEST()
2212 ASSERT_GE(ctx.efd[1], 0); in TEST()
2215 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2218 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2220 ctx.main = pthread_self(); in TEST()
2221 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1op, &ctx), 0); in TEST()
2222 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2224 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2225 __sync_fetch_and_or(&ctx.count, 2); in TEST()
2227 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2228 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST()
2235 close(ctx.efd[0]); in TEST()
2236 close(ctx.efd[1]); in TEST()
2237 close(ctx.sfd[0]); in TEST()
2238 close(ctx.sfd[1]); in TEST()
2255 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2259 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2261 ctx.efd[0] = epoll_create(1); in TEST()
2262 ASSERT_GE(ctx.efd[0], 0); in TEST()
2264 ctx.efd[1] = epoll_create(1); in TEST()
2265 ASSERT_GE(ctx.efd[1], 0); in TEST()
2268 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2271 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2273 ctx.main = pthread_self(); in TEST()
2274 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2275 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2277 pfd.fd = ctx.efd[1]; in TEST()
2280 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
2281 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2284 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2285 EXPECT_EQ(ctx.count, 2); in TEST()
2292 close(ctx.efd[0]); in TEST()
2293 close(ctx.efd[1]); in TEST()
2294 close(ctx.sfd[0]); in TEST()
2295 close(ctx.sfd[1]); in TEST()
2311 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2315 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2317 ctx.efd[0] = epoll_create(1); in TEST()
2318 ASSERT_GE(ctx.efd[0], 0); in TEST()
2320 ctx.efd[1] = epoll_create(1); in TEST()
2321 ASSERT_GE(ctx.efd[1], 0); in TEST()
2324 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2327 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2329 ctx.main = pthread_self(); in TEST()
2330 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1op, &ctx), 0); in TEST()
2331 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2333 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2334 __sync_fetch_and_or(&ctx.count, 2); in TEST()
2336 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2337 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST()
2344 close(ctx.efd[0]); in TEST()
2345 close(ctx.efd[1]); in TEST()
2346 close(ctx.sfd[0]); in TEST()
2347 close(ctx.sfd[1]); in TEST()
2364 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2368 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2370 ctx.efd[0] = epoll_create(1); in TEST()
2371 ASSERT_GE(ctx.efd[0], 0); in TEST()
2373 ctx.efd[1] = epoll_create(1); in TEST()
2374 ASSERT_GE(ctx.efd[1], 0); in TEST()
2377 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2380 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2382 ctx.main = pthread_self(); in TEST()
2383 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2384 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2386 pfd.fd = ctx.efd[1]; in TEST()
2389 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
2390 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2393 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2394 EXPECT_EQ(ctx.count, 2); in TEST()
2401 close(ctx.efd[0]); in TEST()
2402 close(ctx.efd[1]); in TEST()
2403 close(ctx.sfd[0]); in TEST()
2404 close(ctx.sfd[1]); in TEST()
2420 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2424 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2426 ctx.efd[0] = epoll_create(1); in TEST()
2427 ASSERT_GE(ctx.efd[0], 0); in TEST()
2429 ctx.efd[1] = epoll_create(1); in TEST()
2430 ASSERT_GE(ctx.efd[1], 0); in TEST()
2433 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2436 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2438 ctx.main = pthread_self(); in TEST()
2439 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1op, &ctx), 0); in TEST()
2440 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2442 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2443 __sync_fetch_and_or(&ctx.count, 2); in TEST()
2445 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2446 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST()
2453 close(ctx.efd[0]); in TEST()
2454 close(ctx.efd[1]); in TEST()
2455 close(ctx.sfd[0]); in TEST()
2456 close(ctx.sfd[1]); in TEST()
2704 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2708 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
2709 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
2711 ctx.efd[0] = epoll_create(1); in TEST()
2712 ASSERT_GE(ctx.efd[0], 0); in TEST()
2714 ctx.efd[1] = epoll_create(1); in TEST()
2715 ASSERT_GE(ctx.efd[1], 0); in TEST()
2717 ctx.efd[2] = epoll_create(1); in TEST()
2718 ASSERT_GE(ctx.efd[2], 0); in TEST()
2721 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2724 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
2727 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2730 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
2732 ctx.main = pthread_self(); in TEST()
2733 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
2734 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
2736 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2737 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2739 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2740 EXPECT_EQ(ctx.count, 2); in TEST()
2747 close(ctx.efd[0]); in TEST()
2748 close(ctx.efd[1]); in TEST()
2749 close(ctx.efd[2]); in TEST()
2750 close(ctx.sfd[0]); in TEST()
2751 close(ctx.sfd[1]); in TEST()
2752 close(ctx.sfd[2]); in TEST()
2753 close(ctx.sfd[3]); in TEST()
2769 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2773 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
2774 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
2776 ctx.efd[0] = epoll_create(1); in TEST()
2777 ASSERT_GE(ctx.efd[0], 0); in TEST()
2779 ctx.efd[1] = epoll_create(1); in TEST()
2780 ASSERT_GE(ctx.efd[1], 0); in TEST()
2782 ctx.efd[2] = epoll_create(1); in TEST()
2783 ASSERT_GE(ctx.efd[2], 0); in TEST()
2786 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2789 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
2792 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2795 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
2797 ctx.main = pthread_self(); in TEST()
2798 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
2799 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
2801 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2802 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2804 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2805 EXPECT_EQ(ctx.count, 2); in TEST()
2812 close(ctx.efd[0]); in TEST()
2813 close(ctx.efd[1]); in TEST()
2814 close(ctx.efd[2]); in TEST()
2815 close(ctx.sfd[0]); in TEST()
2816 close(ctx.sfd[1]); in TEST()
2817 close(ctx.sfd[2]); in TEST()
2818 close(ctx.sfd[3]); in TEST()
2834 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2838 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
2839 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
2841 ctx.efd[0] = epoll_create(1); in TEST()
2842 ASSERT_GE(ctx.efd[0], 0); in TEST()
2844 ctx.efd[1] = epoll_create(1); in TEST()
2845 ASSERT_GE(ctx.efd[1], 0); in TEST()
2847 ctx.efd[2] = epoll_create(1); in TEST()
2848 ASSERT_GE(ctx.efd[2], 0); in TEST()
2851 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2854 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
2857 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2860 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
2862 ctx.main = pthread_self(); in TEST()
2863 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2864 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
2866 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2867 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2869 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2870 EXPECT_EQ(ctx.count, 2); in TEST()
2877 close(ctx.efd[0]); in TEST()
2878 close(ctx.efd[1]); in TEST()
2879 close(ctx.efd[2]); in TEST()
2880 close(ctx.sfd[0]); in TEST()
2881 close(ctx.sfd[1]); in TEST()
2882 close(ctx.sfd[2]); in TEST()
2883 close(ctx.sfd[3]); in TEST()
2899 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2903 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
2904 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
2906 ctx.efd[0] = epoll_create(1); in TEST()
2907 ASSERT_GE(ctx.efd[0], 0); in TEST()
2909 ctx.efd[1] = epoll_create(1); in TEST()
2910 ASSERT_GE(ctx.efd[1], 0); in TEST()
2912 ctx.efd[2] = epoll_create(1); in TEST()
2913 ASSERT_GE(ctx.efd[2], 0); in TEST()
2916 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2919 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
2922 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2925 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
2927 ctx.main = pthread_self(); in TEST()
2928 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2929 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
2931 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2932 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2934 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2935 EXPECT_EQ(ctx.count, 2); in TEST()
2942 close(ctx.efd[0]); in TEST()
2943 close(ctx.efd[1]); in TEST()
2944 close(ctx.efd[2]); in TEST()
2945 close(ctx.sfd[0]); in TEST()
2946 close(ctx.sfd[1]); in TEST()
2947 close(ctx.sfd[2]); in TEST()
2948 close(ctx.sfd[3]); in TEST()
2965 struct epoll_mtcontext ctx = { 0 }; in TEST() local
2969 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
2970 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
2972 ctx.efd[0] = epoll_create(1); in TEST()
2973 ASSERT_GE(ctx.efd[0], 0); in TEST()
2975 ctx.efd[1] = epoll_create(1); in TEST()
2976 ASSERT_GE(ctx.efd[1], 0); in TEST()
2978 ctx.efd[2] = epoll_create(1); in TEST()
2979 ASSERT_GE(ctx.efd[2], 0); in TEST()
2982 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2985 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
2988 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2991 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
2993 ctx.main = pthread_self(); in TEST()
2994 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2995 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
2997 pfd.fd = ctx.efd[0]; in TEST()
3000 if (epoll_wait(ctx.efd[0], &e, 1, 0) > 0) in TEST()
3001 __sync_fetch_and_add(&ctx.count, 1); in TEST()
3004 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
3005 EXPECT_EQ(ctx.count, 2); in TEST()
3012 close(ctx.efd[0]); in TEST()
3013 close(ctx.efd[1]); in TEST()
3014 close(ctx.efd[2]); in TEST()
3015 close(ctx.sfd[0]); in TEST()
3016 close(ctx.sfd[1]); in TEST()
3017 close(ctx.sfd[2]); in TEST()
3018 close(ctx.sfd[3]); in TEST()
3035 struct epoll_mtcontext ctx = { 0 }; in TEST() local
3039 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
3040 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
3042 ctx.efd[0] = epoll_create(1); in TEST()
3043 ASSERT_GE(ctx.efd[0], 0); in TEST()
3045 ctx.efd[1] = epoll_create(1); in TEST()
3046 ASSERT_GE(ctx.efd[1], 0); in TEST()
3048 ctx.efd[2] = epoll_create(1); in TEST()
3049 ASSERT_GE(ctx.efd[2], 0); in TEST()
3052 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
3055 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
3058 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
3061 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
3063 ctx.main = pthread_self(); in TEST()
3064 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
3065 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
3067 pfd.fd = ctx.efd[0]; in TEST()
3070 if (epoll_wait(ctx.efd[0], &e, 1, 0) > 0) in TEST()
3071 __sync_fetch_and_add(&ctx.count, 1); in TEST()
3074 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
3075 EXPECT_EQ(ctx.count, 2); in TEST()
3082 close(ctx.efd[0]); in TEST()
3083 close(ctx.efd[1]); in TEST()
3084 close(ctx.efd[2]); in TEST()
3085 close(ctx.sfd[0]); in TEST()
3086 close(ctx.sfd[1]); in TEST()
3087 close(ctx.sfd[2]); in TEST()
3088 close(ctx.sfd[3]); in TEST()
3093 struct epoll_mtcontext *ctx = ctx_; in epoll59_thread() local
3098 while (ctx->count == 0) in epoll59_thread()
3102 epoll_ctl(ctx->efd[0], EPOLL_CTL_MOD, ctx->sfd[0], &e); in epoll59_thread()
3103 ctx->count = 0; in epoll59_thread()
3123 struct epoll_mtcontext ctx = { 0 }; in TEST() local
3128 ctx.efd[0] = epoll_create1(0); in TEST()
3129 ASSERT_GE(ctx.efd[0], 0); in TEST()
3131 ctx.sfd[0] = eventfd(1, 0); in TEST()
3132 ASSERT_GE(ctx.sfd[0], 0); in TEST()
3135 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
3137 ASSERT_EQ(pthread_create(&emitter, NULL, epoll59_thread, &ctx), 0); in TEST()
3140 ret = epoll_wait(ctx.efd[0], &e, 1, 1000); in TEST()
3143 while (ctx.count != 0) in TEST()
3145 ctx.count = 1; in TEST()
3151 close(ctx.efd[0]); in TEST()
3152 close(ctx.sfd[0]); in TEST()
3169 struct epoll60_ctx *ctx = ctx_; in epoll60_wait_thread() local
3183 while (!ctx->stopped) { in epoll60_wait_thread()
3185 __atomic_fetch_add(&ctx->ready, 1, __ATOMIC_ACQUIRE); in epoll60_wait_thread()
3188 while (__atomic_load_n(&ctx->ready, __ATOMIC_ACQUIRE) && in epoll60_wait_thread()
3189 !ctx->stopped); in epoll60_wait_thread()
3192 __atomic_fetch_add(&ctx->waiters, 1, __ATOMIC_ACQUIRE); in epoll60_wait_thread()
3194 ret = epoll_pwait(ctx->epfd, &e, 1, 2000, &sigmask); in epoll60_wait_thread()
3198 assert(ctx->stopped); in epoll60_wait_thread()
3206 __atomic_fetch_sub(&ctx->waiters, 1, __ATOMIC_RELEASE); in epoll60_wait_thread()
3224 static inline int count_waiters(struct epoll60_ctx *ctx) in count_waiters() argument
3226 return __atomic_load_n(&ctx->waiters, __ATOMIC_ACQUIRE); in count_waiters()
3231 struct epoll60_ctx ctx = { 0 }; in TEST() local
3232 pthread_t waiters[ARRAY_SIZE(ctx.evfd)]; in TEST()
3238 ctx.epfd = epoll_create1(0); in TEST()
3239 ASSERT_GE(ctx.epfd, 0); in TEST()
3242 for (i = 0; i < ARRAY_SIZE(ctx.evfd); i++) { in TEST()
3243 ctx.evfd[i] = eventfd(0, EFD_NONBLOCK); in TEST()
3244 ASSERT_GE(ctx.evfd[i], 0); in TEST()
3247 e.data.fd = ctx.evfd[i]; in TEST()
3248 ASSERT_EQ(epoll_ctl(ctx.epfd, EPOLL_CTL_ADD, ctx.evfd[i], &e), 0); in TEST()
3254 epoll60_wait_thread, &ctx), 0); in TEST()
3260 while (__atomic_load_n(&ctx.ready, __ATOMIC_ACQUIRE) != in TEST()
3261 ARRAY_SIZE(ctx.evfd)) in TEST()
3265 __atomic_fetch_sub(&ctx.ready, ARRAY_SIZE(ctx.evfd), in TEST()
3269 while (count_waiters(&ctx) != ARRAY_SIZE(ctx.evfd)) in TEST()
3276 for (n = 0; n < ARRAY_SIZE(ctx.evfd); n++) { in TEST()
3277 ret = write(ctx.evfd[n], &v, sizeof(v)); in TEST()
3283 while (count_waiters(&ctx) && msecs() < ms + 1000) in TEST()
3286 ASSERT_EQ(count_waiters(&ctx), 0); in TEST()
3288 ctx.stopped = 1; in TEST()
3296 close(ctx.evfd[i]); in TEST()
3297 close(ctx.epfd); in TEST()
3307 struct epoll61_ctx *ctx = ctx_; in epoll61_write_eventfd() local
3311 write(ctx->evfd, &l, sizeof(l)); in epoll61_write_eventfd()
3317 struct epoll61_ctx *ctx = ctx_; in epoll61_epoll_with_timeout() local
3321 n = epoll_wait(ctx->epfd, events, 1, 11); in epoll61_epoll_with_timeout()
3329 write(ctx->evfd, &l, sizeof(l)); in epoll61_epoll_with_timeout()
3336 struct epoll61_ctx *ctx = ctx_; in epoll61_blocking_epoll() local
3339 epoll_wait(ctx->epfd, events, 1, -1); in epoll61_blocking_epoll()
3345 struct epoll61_ctx ctx; in TEST() local
3349 ctx.epfd = epoll_create1(0); in TEST()
3350 ASSERT_GE(ctx.epfd, 0); in TEST()
3351 ctx.evfd = eventfd(0, EFD_NONBLOCK); in TEST()
3352 ASSERT_GE(ctx.evfd, 0); in TEST()
3356 r = epoll_ctl(ctx.epfd, EPOLL_CTL_ADD, ctx.evfd, &ev); in TEST()
3381 epoll61_write_eventfd, &ctx), 0); in TEST()
3383 epoll61_epoll_with_timeout, &ctx), 0); in TEST()
3385 epoll61_blocking_epoll, &ctx), 0); in TEST()
3391 close(ctx.epfd); in TEST()
3392 close(ctx.evfd); in TEST()
3463 struct epoll_mtcontext ctx = { 0 }; in TEST() local
3467 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
3469 ctx.efd[0] = epoll_create(1); in TEST()
3470 ASSERT_GE(ctx.efd[0], 0); in TEST()
3473 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
3479 ctx.main = pthread_self(); in TEST()
3480 ASSERT_EQ(pthread_create(&waiter[0], NULL, waiter_entry1a, &ctx), 0); in TEST()
3481 ASSERT_EQ(pthread_create(&waiter[1], NULL, waiter_entry1a, &ctx), 0); in TEST()
3484 ASSERT_EQ(write(ctx.sfd[1], "w", 1), 1); in TEST()
3489 EXPECT_EQ(ctx.count, 2); in TEST()
3491 close(ctx.efd[0]); in TEST()
3492 close(ctx.sfd[0]); in TEST()
3493 close(ctx.sfd[1]); in TEST()