poll: fix compile errors caused by ambiguous naming of poll_event in poll_handle (#281)

This commit is contained in:
Reimu NotMoe 2023-05-08 14:08:30 +08:00 committed by GitHub
parent 950aa6486e
commit e059473135
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -20,7 +20,7 @@ UVW_INLINE void poll_handle::start_callback(uv_poll_t *hndl, int status, int eve
if(poll_handle &poll = *(static_cast<poll_handle *>(hndl->data)); status) { if(poll_handle &poll = *(static_cast<poll_handle *>(hndl->data)); status) {
poll.publish(error_event{status}); poll.publish(error_event{status});
} else { } else {
poll.publish(poll_event{poll_event(events)}); poll.publish(poll_event{poll_event_flags(events)});
} }
} }
@ -32,7 +32,7 @@ UVW_INLINE int poll_handle::init() {
} }
} }
UVW_INLINE int poll_handle::start(poll_handle::poll_event flags) { UVW_INLINE int poll_handle::start(poll_event_flags flags) {
return uv_poll_start(raw(), static_cast<uv_poll_event>(flags), &start_callback); return uv_poll_start(raw(), static_cast<uv_poll_event>(flags), &start_callback);
} }

View File

@ -56,11 +56,11 @@ struct poll_event {
* [documentation](http://docs.libuv.org/en/v1.x/poll.html) * [documentation](http://docs.libuv.org/en/v1.x/poll.html)
* for further details. * for further details.
*/ */
class poll_handle final: public handle<poll_handle, uv_poll_t, details::uvw_poll_event> { class poll_handle final: public handle<poll_handle, uv_poll_t, poll_event> {
static void start_callback(uv_poll_t *hndl, int status, int events); static void start_callback(uv_poll_t *hndl, int status, int events);
public: public:
using poll_event = details::uvw_poll_event; using poll_event_flags = details::uvw_poll_event;
explicit poll_handle(loop::token token, std::shared_ptr<loop> ref, int desc); explicit poll_handle(loop::token token, std::shared_ptr<loop> ref, int desc);
explicit poll_handle(loop::token token, std::shared_ptr<loop> ref, os_socket_handle sock); explicit poll_handle(loop::token token, std::shared_ptr<loop> ref, os_socket_handle sock);
@ -90,7 +90,7 @@ public:
* @param flags The events to which the caller is interested. * @param flags The events to which the caller is interested.
* @return Underlying return value. * @return Underlying return value.
*/ */
int start(poll_event flags); int start(poll_event_flags flags);
/** /**
* @brief Stops polling the file descriptor. * @brief Stops polling the file descriptor.