有没有C大师曾在C中实现过Epoll Non-blocking选择器,我可以从Java调用,所以我不必使用Java的NIO Epoll实现?
答案 0 :(得分:0)
你可以找到我用C编写的epoll示例程序。我希望这会对你有所帮助Could you recommend some guides about Epoll on Linux
答案 1 :(得分:0)
Java 6中的SelectorProvider使用epoll,如果它在内核2.6或更高版本的Linux上运行。
答案 2 :(得分:0)
是的,java支持epoll
在JVM源代码中,您可以找到以下代码
JNIEXPORT jint JNICALL
Java_sun_nio_ch_EPoll_epollCreate(JNIEnv *env, jclass c) {
/*
* epoll_create expects a size as a hint to the kernel about how to
* dimension internal structures. We can't predict the size in advance.
*/
int epfd = epoll_create(256);
if (epfd < 0) {
JNU_ThrowIOExceptionWithLastError(env, "epoll_create failed");
}
return epfd;
}