INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

hydroiceutil::JobQueue Class Reference

A queue of jobs to be processed. More...

#include <jobqueue.h>

Inherits hydroutil::Uncopyable.

Inherited by hydroiceutil::EventLoop.

List of all members.

Classes

struct  Config
 Job queue configuration structure. More...

Public Member Functions

 JobQueue (gbxutilacfr::Tracer &tracer, const Config &config=Config())
 ~JobQueue ()
 Calls stop() if any the worker threads are still running.
void stop ()
void add (const JobPtr &job)
 Add request to execute a job. If add() is called after stop(), the request to add a job is quietly ignored.
JobQueueStatus status ()
 Returns current queue status.
std::string toString ()
 Returns a return-separated listing of all active and pending jobs.

Detailed Description

A queue of jobs to be processed.

Rather than tie up the main thread, calls which may take a long time can be placed on this job queue. They will be processed by a pool of threads.

If you need the jobs to communicate results or status updates to their owners, you may want to use the event mechanism,

See also:
Event, EventReceiver.
Author:
Alex Brooks, Alex Makarenko

Constructor & Destructor Documentation

hydroiceutil::JobQueue::JobQueue ( gbxutilacfr::Tracer &  tracer,
const Config config = Config() 
)

Constructor. For queueSizeWarn>0, a warning will be traced when the queue size exceeds specified size.

Worker threads are started in the constructor.

References hydroiceutil::JobQueue::Config::threadPoolSize, hydroiceutil::JobQueue::Config::traceDoneEvents, hydroiceutil::JobQueue::Config::traceStartEvents, and hydroiceutil::JobQueue::Config::validate().


Member Function Documentation

void hydroiceutil::JobQueue::stop (  ) 

Stops accepting new jobs, clears all pending jobs, cancels all running jobs and stops the worker pool. Will not return until all workers have stopped. Use this function instead of relying on the destructor to call it if you need to make sure that the thread pool is stopped before other objects (e.g. threads) are destroyed.

Referenced by ~JobQueue().


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

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5