2

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?

JohnPristine
  • 3,485
  • 5
  • 30
  • 49

3 Answers3

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

Community
  • 1
  • 1
Viswesn
  • 4,674
  • 2
  • 28
  • 45
  • 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