mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-05 19:21:59 +01:00
Locate and position the current Audacity source code, and clear a variety of old junk out of the way into junk-branches
This commit is contained in:
57
src/commands/ResponseQueue.cpp
Normal file
57
src/commands/ResponseQueue.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity - A Digital Audio Editor
|
||||
Copyright 1999-2009 Audacity Team
|
||||
File License: wxWidgets
|
||||
|
||||
Dan Horgan
|
||||
|
||||
******************************************************************//**
|
||||
|
||||
\file ResponseQueue.cpp
|
||||
\brief Contains definitions for the ResponseQueue class
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "ResponseQueue.h"
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <wx/thread.h>
|
||||
|
||||
ResponseQueue::ResponseQueue()
|
||||
: mCondition(mMutex)
|
||||
{ }
|
||||
|
||||
ResponseQueue::~ResponseQueue()
|
||||
{ }
|
||||
|
||||
void ResponseQueue::AddResponse(Response response)
|
||||
{
|
||||
wxMutexLocker locker(mMutex);
|
||||
mResponses.push(response);
|
||||
mCondition.Signal();
|
||||
}
|
||||
|
||||
Response ResponseQueue::WaitAndGetResponse()
|
||||
{
|
||||
wxMutexLocker locker(mMutex);
|
||||
if (mResponses.empty())
|
||||
{
|
||||
mCondition.Wait();
|
||||
}
|
||||
wxASSERT(!mResponses.empty());
|
||||
Response msg = mResponses.front();
|
||||
mResponses.pop();
|
||||
return msg;
|
||||
}
|
||||
|
||||
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
|
||||
// version control system. Please do not modify past this point.
|
||||
//
|
||||
// Local Variables:
|
||||
// c-basic-offset: 3
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
//
|
||||
// vim: et sts=3 sw=3
|
||||
// arch-tag: TBD
|
||||
Reference in New Issue
Block a user