uvw 2.12.1
Loading...
Searching...
No Matches
uvw::WorkReq Class Referencefinal

The WorkReq request. More...

#include <work.h>

Inheritance diagram for uvw::WorkReq:
Collaboration diagram for uvw::WorkReq:

Public Member Functions

void queue ()
 Runs the given task in a separate thread.
 
- Public Member Functions inherited from uvw::Request< WorkReq, uv_work_t >
bool 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< WorkReq, uv_work_t >
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::UnderlyingType< WorkReq, uv_work_t >
Looploop () const noexcept
 Gets the loop from which the resource was originated.
 
const uv_work_t * raw () const noexcept
 Gets the underlying raw data structure.
 
uv_work_t * raw () noexcept
 Gets the underlying raw data structure.
 
- Public Member Functions inherited from uvw::Emitter< WorkReq >
Connection< E > on (Listener< E > f)
 Registers a long-lived listener with the event emitter.
 
Connection< E > once (Listener< E > f)
 Registers a short-lived listener with the event emitter.
 
void erase (Connection< E > conn) noexcept
 Disconnects a listener from the event emitter.
 
void clear () noexcept
 Disconnects all the listeners for the given event type.
 
void clear () noexcept
 Disconnects all the listeners.
 
bool empty () const noexcept
 Checks if there are listeners registered for the specific event.
 
bool empty () const noexcept
 Checks if there are listeners registered with the event emitter.
 

Additional Inherited Members

- Public Types inherited from uvw::Emitter< WorkReq >
- Static Public Member Functions inherited from uvw::UnderlyingType< WorkReq, uv_work_t >
static std::shared_ptr< WorkReqcreate (Args &&...args)
 Creates a new resource of the given type.
 
- Protected Types inherited from uvw::Resource< WorkReq, uv_work_t >
- Protected Member Functions inherited from uvw::Request< WorkReq, uv_work_t >
- Protected Member Functions inherited from uvw::Resource< WorkReq, uv_work_t >
- Protected Member Functions inherited from uvw::UnderlyingType< WorkReq, uv_work_t >
- Protected Member Functions inherited from uvw::Emitter< WorkReq >
- Static Protected Member Functions inherited from uvw::Request< WorkReq, uv_work_t >

Detailed Description

The WorkReq 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 WorkReq through a Loop, arguments follow:

  • A valid instance of a Task, that is of type std::function<void(void)>.

See the official documentation for further details.

Definition at line 33 of file work.h.

Member Function Documentation

◆ queue()

void uvw::WorkReq::queue ( )

Runs the given task in a separate thread.

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


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