Has any C guru ever implemented a Epoll Non-blocking selector in C that I can call from Java so I don't have to use Java's NIO Epoll implementation?
Asked
Active
Viewed 783 times
2
-
what's wrong with the one in NIO? If you describe your problem maybe this community can help you work around it better. – Some programmer dude Aug 29 '12 at 05:13
-
@JoachimPileborg I am hoping that a native C implementation can be fine-tuned for better latency than the one implemented by Sun. – JohnPristine Aug 29 '12 at 05:15
3 Answers
0
You can find epoll sample program written in C by me. I hope that will help you Could you recommend some guides about Epoll on Linux
-
Thanks, but I would not be able to take this code and code something with Java + JNI. I guess I will make peace with the standard Java NIO implementations. :) – JohnPristine Aug 29 '12 at 14:03
0
SelectorProvider in Java 6 uses epoll if it's run on Linux with kernel 2.6 or higher.

expert
- 29,290
- 30
- 110
- 214
0
yes, java support epoll
in JVM source code, you can find the follow code
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;
}

Kishan_KP
- 4,488
- 6
- 27
- 46

jingchun.zhang
- 81
- 2