monotone

monotone Mtn Source Tree

Root/threads.hh

1#ifndef __THREADS_HH__
2#define __THREADS_HH__
3
4// Copyright (C) 2008 Markus Wanner <markus@bluegap.ch>
5//
6// This program is made available under the GNU GPL version 2.0 or
7// greater. See the accompanying file COPYING for details.
8//
9// This program is distributed WITHOUT ANY WARRANTY; without even the
10// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11// PURPOSE.
12
13#include <stack>
14#include <boost/shared_ptr.hpp>
15
16class threaded_task
17{
18public:
19 virtual void operator()() = 0;
20};
21
22class worker_pool
23{
24 int max_threads, num_threads;
25 std::stack<threaded_task*> tstack;
26public:
27 worker_pool();
28 void add_job(threaded_task* t);
29 void wait();
30};
31
32// Local Variables:
33// mode: C++
34// fill-column: 76
35// c-file-style: "gnu"
36// indent-tabs-mode: nil
37// End:
38// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
39
40#endif // __THREADS_HH__

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status