Audacity 3.2.0
ResponseQueue.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity - A Digital Audio Editor
4 Copyright 1999-2009 Audacity Team
5 File License: wxWidgets
6
7 Dan Horgan
8
9******************************************************************//*******************************************************************/
15
16#include "ResponseQueue.h"
17
18#include <queue>
19#include <string>
20#include <wx/thread.h>
21
23 : mCondition(mMutex)
24{ }
25
27{ }
28
30{
31 wxMutexLocker locker(mMutex);
32 mResponses.push(response);
33 mCondition.Signal();
34}
35
37{
38 wxMutexLocker locker(mMutex);
39 if (mResponses.empty())
40 {
41 mCondition.Wait();
42 }
43 wxASSERT(!mResponses.empty());
44 Response msg = mResponses.front();
45 mResponses.pop();
46 return msg;
47}
Contains declarations for Response and ResponseQueue classes.
Stores a command response string (and other response data if it becomes necessary)
Definition: ResponseQueue.h:46
std::queue< Response > mResponses
Definition: ResponseQueue.h:62
Response WaitAndGetResponse()
void AddResponse(Response response)
wxMutex mMutex
Definition: ResponseQueue.h:63
wxCondition mCondition
Definition: ResponseQueue.h:64