Kyoto Cabinet
Classes | Public Member Functions
kyotocabinet::TaskQueue Class Reference

Task queue device. More...

#include <kcthread.h>

List of all members.

Classes

class  Task
 Interface of a task. More...
class  WorkerThread
 Implementation of the worker thread.

Public Member Functions

 TaskQueue ()
 Default Constructor.
virtual ~TaskQueue ()
 Destructor.
virtual void do_task (Task *task)=0
 Process a task.
virtual void do_start (const Task *task)
 Process the starting event.
virtual void do_finish (const Task *task)
 Process the finishing event.
void start (size_t thnum)
 Start the task queue.
void finish ()
 Finish the task queue.
int64_t add_task (Task *task)
 Add a task.
int64_t count ()
 Get the number of tasks in the queue.

Detailed Description

Task queue device.


Constructor & Destructor Documentation

Default Constructor.

virtual kyotocabinet::TaskQueue::~TaskQueue ( ) [virtual]

Destructor.


Member Function Documentation

virtual void kyotocabinet::TaskQueue::do_task ( Task task) [pure virtual]

Process a task.

Parameters:
taska task object.
virtual void kyotocabinet::TaskQueue::do_start ( const Task task) [virtual]

Process the starting event.

Parameters:
taska task object.
Note:
This is called for each thread on starting.
virtual void kyotocabinet::TaskQueue::do_finish ( const Task task) [virtual]

Process the finishing event.

Parameters:
taska task object.
Note:
This is called for each thread on finishing.
void kyotocabinet::TaskQueue::start ( size_t  thnum)

Start the task queue.

Parameters:
thnumthe number of worker threads.

Finish the task queue.

Note:
This function blocks until all tasks in the queue are popped.

Add a task.

Parameters:
taska task object.
Returns:
the number of tasks in the queue.

Get the number of tasks in the queue.

Returns:
the number of tasks in the queue.