java.lang.Object
com.oracle.libuv.Handle
com.oracle.libuv.AsyncHandle
- All Implemented Interfaces:
Closeable,AutoCloseable
Async handles allow the user to wakeup the event loop and
get a callback called from another thread.
See Async handle
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the handle and free up any resources that may be held by it.intsend()Wake up the event loop and call the specified callback.voidsetAsyncCallback(AsyncCallback callback)Attach aAsyncCallback.
-
Method Details
-
setAsyncCallback
Attach aAsyncCallback.- Parameters:
callback- A callback, which will be executed after a loop will receive an async signal from this handle.- Throws:
IllegalStateException- if this method called more than once.
-
send
public int send()Wake up the event loop and call the specified callback.It's safe to call this function from any thread. The callback will be called on the loop thread.
- Returns:
0on success, or an errorcode < 0on failure.
-
close
public void close()Close the handle and free up any resources that may be held by it.CloseCallbackcallback will be invoked right before the close.
-