Home / Function/ testEpollWaitWithTimeOutMinusOne() — netty Function Reference

testEpollWaitWithTimeOutMinusOne() — netty Function Reference

Architecture documentation for the testEpollWaitWithTimeOutMinusOne() function in EpollTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  2ba665b3_bded_4ce6_3891_186c95e006e8["testEpollWaitWithTimeOutMinusOne()"]
  d19acad4_cac4_5960_b5c8_a3e77d808f28["EpollTest"]
  2ba665b3_bded_4ce6_3891_186c95e006e8 -->|defined in| d19acad4_cac4_5960_b5c8_a3e77d808f28
  style 2ba665b3_bded_4ce6_3891_186c95e006e8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollTest.java lines 61–98

    @Test
    @Timeout(value = 5000, unit = TimeUnit.MILLISECONDS)
    public void testEpollWaitWithTimeOutMinusOne() throws Exception  {
        final EpollEventArray eventArray = new EpollEventArray(8);
        try {
            final FileDescriptor epoll = Native.newEpollCreate();
            final FileDescriptor timerFd = Native.newTimerFd();
            final FileDescriptor eventfd = Native.newEventFd();
            Native.epollCtlAdd(epoll.intValue(), timerFd.intValue(), Native.EPOLLIN);
            Native.epollCtlAdd(epoll.intValue(), eventfd.intValue(), Native.EPOLLIN);

            final AtomicReference<Throwable> ref = new AtomicReference<Throwable>();
            Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        assertEquals(1, Native.epollWait(epoll, eventArray, false));
                        // This should have been woken up because of eventfd_write.
                        assertEquals(eventfd.intValue(), eventArray.fd(0));
                    } catch (Throwable cause) {
                        ref.set(cause);
                    }
                }
            });
            t.start();
            t.join(1000);
            assertTrue(t.isAlive());
            Native.eventFdWrite(eventfd.intValue(), 1);

            t.join();
            assertNull(ref.get());
            epoll.close();
            timerFd.close();
            eventfd.close();
        } finally {
            eventArray.free();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testEpollWaitWithTimeOutMinusOne() do?
testEpollWaitWithTimeOutMinusOne() is a function in the netty codebase, defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollTest.java.
Where is testEpollWaitWithTimeOutMinusOne() defined?
testEpollWaitWithTimeOutMinusOne() is defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollTest.java at line 61.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free