/[svn]/linuxsampler/trunk/src/common/WorkerThread.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/common/WorkerThread.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2434 - (show annotations) (download) (as text)
Thu Mar 7 19:23:24 2013 UTC (11 years, 1 month ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 2543 byte(s)
* Started to spread new C++ keyword "override" over the code base
  (keyword introduced with C++11 standard).

1 /***************************************************************************
2 * *
3 * Copyright (C) 2007 Grigor Iliev *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
18 * MA 02110-1301 USA *
19 ***************************************************************************/
20
21 #ifndef __WORKER_THREAD_H__
22 #define __WORKER_THREAD_H__
23
24 #include <list>
25
26 #include "Condition.h"
27 #include "Mutex.h"
28 #include "global_private.h"
29 #include "Thread.h"
30
31 namespace LinuxSampler {
32 class WorkerThread : public Thread {
33 public:
34 WorkerThread();
35
36 /**
37 * Schedules the specified job for execution.
38 * Note that the specified Runnable object must be allocated
39 * using the new operator. The object is automatically deleted
40 * when the job is finished.
41 */
42 void Execute(Runnable* pJob);
43
44 /**
45 * The entry point of the thread.
46 */
47 virtual int Main() OVERRIDE;
48
49 private:
50 std::list<Runnable*> queue; // the queue, which holds the jobs to be executed
51 Mutex mutex; // used to synchronize the queue
52 Condition conditionJobsLeft; // synchronizer to block this thread until a new job arrives
53 };
54
55 } // namespace LinuxSampler
56
57 #endif // __WORKER_THREAD_H__

  ViewVC Help
Powered by ViewVC