/[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 1424 - (show annotations) (download) (as text)
Sun Oct 14 22:00:17 2007 UTC (16 years, 6 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 2534 byte(s)
* code cleanup:
- global.h now only covers global definitions that are needed for the C++
  API header files, all implementation internal global definitions are now
  in global_private.h
- atomic.h is not exposed to the C++ API anymore (replaced the references
  in SynchronizedConfig.h for this with local definitions)
- no need to include config.h anymore for using LS's API header files
- DB instruments classes are not exposed to the C++ API
- POSIX callback functions of Thread.h are hidden
- the (optional) gig Engine benchmark compiles again
- updated Doxyfile.in
- fixed warnings in API doc generation
* preparations for release 0.5.0

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();
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