uvw 3.1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
uvw::work_req Class Referencefinal

The work request. More...

#include <work.h>

Inheritance diagram for uvw::work_req:
Inheritance graph
[legend]
Collaboration diagram for uvw::work_req:
Collaboration graph
[legend]

Public Member Functions

int queue ()
 Runs the given task in a separate thread.
 
- Public Member Functions inherited from uvw::request< work_req, uv_work_t, work_event >
int cancel ()
 Cancels a pending request.
 
std::size_t size () const noexcept
 Returns the size of the underlying request type.
 
- Public Member Functions inherited from uvw::resource< T, U, E >
template<typename R = void>
std::shared_ptr< R > data () const
 Gets user-defined data. uvw won't use this field in any case.
 
void data (std::shared_ptr< void > udata)
 Sets arbitrary data. uvw won't use this field in any case.
 
- Public Member Functions inherited from uvw::uv_type< U >
virtual int init ()
 Initializes the handle.
 
loopparent () const noexcept
 Gets the loop from which the resource was originated.
 
const U * raw () const noexcept
 Gets the underlying raw data structure.
 
U * raw () noexcept
 Gets the underlying raw data structure.
 
- Public Member Functions inherited from uvw::emitter< T, E... >
void on (listener_t< U > f)
 Registers a long-lived listener with the event emitter.
 
void reset () noexcept
 Disconnects the listener for the given event type.
 
void reset () noexcept
 Disconnects all listeners.
 
bool has () const noexcept
 Checks if there is a listener registered for the specific event.
 

Detailed Description

The work request.

It runs user code using a thread from the threadpool and gets notified in the loop thread by means of an event.

To create a work_req through a loop, arguments follow:

See the official documentation for further details.

Definition at line 29 of file work.h.

Member Function Documentation

◆ queue()

int uvw::work_req::queue ( )

Runs the given task in a separate thread.

A work event will be emitted on the loop thread when the task is finished.
This request can be cancelled with cancel().

Returns
Underlying return value.

The documentation for this class was generated from the following file: