# Worker.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/core/async/worker/Worker.hpp"

# Worker

Worker base class. Workers are used by oatpp::async::Executor to reschedule worker-specific tasks from oatpp::async::Processor.

namespace oatpp { namespace async { namespace worker { 
  class Worker {}
}}}

# Methods

Return Type Name Summary
[none] Worker Constructor.
[none] ~Worker Default virtual destructor.
void pushTasks Push list of tasks to worker.
void pushOneTask Push one task to worker.
void stop Break run loop.
void join Join all worker-threads.
void detach Detach all worker-threads.
Type getType Get worker type.

# Worker::Worker

Constructor.

Worker(Type type)

# Worker::~Worker

Default virtual destructor.

virtual ~Worker() = default

# Worker::pushTasks

Push list of tasks to worker.

virtual void pushTasks(oatpp::collection::FastQueue<CoroutineHandle>& tasks) = 0

# Worker::pushOneTask

Push one task to worker.

virtual void pushOneTask(CoroutineHandle* task) = 0

# Worker::stop

Break run loop.

virtual void stop() = 0

# Worker::join

Join all worker-threads.

virtual void join() = 0

# Worker::detach

Detach all worker-threads.

virtual void detach() = 0

# Worker::getType

Get worker type.

Type getType()

# Worker::Type

Worker type

namespace oatpp { namespace async { namespace worker { 
  class Worker {}
}}}

# Worker::Type::PROCESSOR

Worker type - general processor.

PROCESSOR = 0

# Worker::Type::TIMER

Worker type - timer processor.

TIMER = 1

# Worker::Type::IO

Worker type - I/O processor.

IO = 2

# Worker::Type::TYPES_COUNT

Number of types in this enum.

TYPES_COUNT = 3