mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-16 09:31:14 +01:00
RAII object for pausing and unpausing OD manager
This commit is contained in:
@@ -330,7 +330,7 @@ void ODManager::Start()
|
||||
//static function that prevents ODTasks from being scheduled
|
||||
//does not stop currently running tasks from completing their immediate subtask,
|
||||
//but presumably they will finish within a second
|
||||
void ODManager::Pause(bool pause)
|
||||
void ODManager::Pauser::Pause(bool pause)
|
||||
{
|
||||
if(IsInstanceCreated())
|
||||
{
|
||||
@@ -349,7 +349,7 @@ void ODManager::Pause(bool pause)
|
||||
}
|
||||
}
|
||||
|
||||
void ODManager::Resume()
|
||||
void ODManager::Pauser::Resume()
|
||||
{
|
||||
Pause(false);
|
||||
}
|
||||
|
||||
@@ -106,9 +106,18 @@ class ODManager final
|
||||
///Get Total Number of Tasks.
|
||||
int GetTotalNumTasks();
|
||||
|
||||
//Pause/unpause all OD Tasks. Does not occur immediately.
|
||||
static void Pause(bool pause = true);
|
||||
static void Resume();
|
||||
// RAII object for pausing and resuming..
|
||||
class Pauser
|
||||
{
|
||||
//Pause/unpause all OD Tasks. Does not occur immediately.
|
||||
static void Pause(bool pause = true);
|
||||
static void Resume();
|
||||
public:
|
||||
Pauser() { Pause(); }
|
||||
~Pauser() { Resume(); }
|
||||
Pauser(const Pauser&) PROHIBITED;
|
||||
Pauser &operator= (const Pauser&) PROHIBITED;
|
||||
};
|
||||
|
||||
static void LockLibSndFileMutex();
|
||||
static void UnlockLibSndFileMutex();
|
||||
|
||||
Reference in New Issue
Block a user