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

Diff of /linuxsampler/trunk/src/common/WorkerThread.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3765 by persson, Sat Mar 2 07:03:04 2013 UTC revision 3766 by schoenebeck, Mon Apr 6 12:41:49 2020 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2007 - 2013 Christian Schoenebeck, Grigor Iliev         *   *   Copyright (C) 2007 - 2020 Christian Schoenebeck                       *
4     *   Copyright (C) 2007 - 2013 Grigor Iliev                                *
5   *                                                                         *   *                                                                         *
6   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
7   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 37  namespace LinuxSampler { Line 38  namespace LinuxSampler {
38    
39      // Entry point for the worker thread.      // Entry point for the worker thread.
40      int WorkerThread::Main() {      int WorkerThread::Main() {
41    
42            #if DEBUG
43            Thread::setNameOfCaller("LSWorker");
44            #endif
45    
46          while (true) {          while (true) {
47    
             #if CONFIG_PTHREAD_TESTCANCEL  
48              TestCancel();              TestCancel();
49              #endif  
50                // prevent worker thread from being cancelled
51                // (e.g. to prevent deadlocks while holding mutex lock(s))
52                pushCancelable(false);
53    
54              while (true) {              while (true) {
55                  Runnable* pJob;                  Runnable* pJob;
56    
# Line 66  namespace LinuxSampler { Line 75  namespace LinuxSampler {
75                  delete pJob;                  delete pJob;
76              }              }
77    
78                // now allow worker thread being cancelled again
79                // (since all mutexes are now unlocked)
80                popCancelable();
81    
82              // nothing left to do, sleep until new jobs arrive              // nothing left to do, sleep until new jobs arrive
83              conditionJobsLeft.WaitIf(false);              conditionJobsLeft.WaitIf(false);
84              // reset flag              // reset flag

Legend:
Removed from v.3765  
changed lines
  Added in v.3766

  ViewVC Help
Powered by ViewVC