testEventFDETSemantics() — netty Function Reference
Architecture documentation for the testEventFDETSemantics() function in EpollEventLoopTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD bf0952e3_87ed_60f2_96b4_800662896698["testEventFDETSemantics()"] bfe6ddcc_7826_010d_3f8f_df4f5668832e["EpollEventLoopTest"] bf0952e3_87ed_60f2_96b4_800662896698 -->|defined in| bfe6ddcc_7826_010d_3f8f_df4f5668832e style bf0952e3_87ed_60f2_96b4_800662896698 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollEventLoopTest.java lines 100–148
@Test
public void testEventFDETSemantics() throws Throwable {
final FileDescriptor epoll = Native.newEpollCreate();
final FileDescriptor eventFd = Native.newEventFd();
final FileDescriptor timerFd = Native.newTimerFd();
final EpollEventArray array = new EpollEventArray(1024);
try {
Native.epollCtlAdd(epoll.intValue(), eventFd.intValue(), Native.EPOLLIN | Native.EPOLLET);
final AtomicReference<Throwable> causeRef = new AtomicReference<Throwable>();
final AtomicInteger integer = new AtomicInteger();
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
for (int i = 0; i < 2; i++) {
int ready = Native.epollWait(epoll, array, timerFd, -1, -1);
assertEquals(1, ready);
assertEquals(eventFd.intValue(), array.fd(0));
integer.incrementAndGet();
}
} catch (IOException e) {
causeRef.set(e);
}
}
});
t.start();
Native.eventFdWrite(eventFd.intValue(), 1);
// Spin until we was the wakeup.
while (integer.get() != 1) {
Thread.sleep(10);
}
// Sleep for a short moment to ensure there is not other wakeup.
Thread.sleep(1000);
assertEquals(1, integer.get());
Native.eventFdWrite(eventFd.intValue(), 1);
t.join();
Throwable cause = causeRef.get();
if (cause != null) {
throw cause;
}
assertEquals(2, integer.get());
} finally {
array.free();
epoll.close();
eventFd.close();
timerFd.close();
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testEventFDETSemantics() do?
testEventFDETSemantics() is a function in the netty codebase, defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollEventLoopTest.java.
Where is testEventFDETSemantics() defined?
testEventFDETSemantics() is defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollEventLoopTest.java at line 100.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free