mirror of
https://gitee.com/openharmony/third_party_libuv
synced 2025-01-14 08:40:44 +00:00
!11 add: user defined interface(uv_poll_init_with_block_socket)
Merge pull request !11 from 熊磊/libuv1224
This commit is contained in:
commit
66ab796626
@ -789,6 +789,8 @@ enum uv_poll_event {
|
||||
UV_PRIORITIZED = 8
|
||||
};
|
||||
|
||||
// User defined interface, to poll a block socket
|
||||
UV_EXTERN int uv_poll_init_with_block_socket(uv_loop_t* loop, uv_poll_t* handle, int fd);
|
||||
UV_EXTERN int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd);
|
||||
UV_EXTERN int uv_poll_init_socket(uv_loop_t* loop,
|
||||
uv_poll_t* handle,
|
||||
|
@ -65,6 +65,23 @@ static void uv__poll_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
||||
}
|
||||
|
||||
|
||||
int uv_poll_init_with_block_socket(uv_loop_t* loop, uv_poll_t* handle, int fd) {
|
||||
int err;
|
||||
|
||||
if (uv__fd_exists(loop, fd))
|
||||
return UV_EEXIST;
|
||||
|
||||
err = uv__io_check_fd(loop, fd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
uv__handle_init(loop, (uv_handle_t*) handle, UV_POLL);
|
||||
uv__io_init(&handle->io_watcher, uv__poll_io, fd);
|
||||
handle->poll_cb = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) {
|
||||
int err;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user