本文整理汇总了C++中CriticalSection::exit方法的典型用法代码示例。如果您正苦于以下问题:C++ CriticalSection::exit方法的具体用法?C++ CriticalSection::exit怎么用?C++ CriticalSection::exit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CriticalSection
的用法示例。
在下文中一共展示了CriticalSection::exit方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JUCETaskCreate
void JUCETaskCreate(void (*pvTaskCode)(void * ), const signed char *pcName,
void *pvParameters, int uxPriority, int *pxCreatedTask)
{
tasklistmutex.enter();
if (arrayinited != true)
{
for (unsigned int i = 0; i < MAX_JUCETASKS; i++)
{
taskArray[i] = NULL;
}
arrayinited = true;
}
unsigned int thisID = MAX_JUCETASKS;
for (unsigned int i = 0; i < MAX_JUCETASKS; i++)
{
if (taskArray[i] == NULL)
{
thisID = i;
break;
}
}
if (thisID == MAX_JUCETASKS) return;
JUCETask *newtask;
String newname = (const char*) pcName;
newtask = new JUCETask(newname);
newtask->TaskFunction = pvTaskCode;
newtask->parameters = pvParameters;
newtask->iD = thisID;
taskArray[thisID] = newtask;
if (pxCreatedTask != NULL) *pxCreatedTask = thisID;
newtask->startThread(uxPriority);
tasklistmutex.exit();
}
示例2: MutexList_Del
void MutexList_Del(CriticalSection *mutexPointer)
{
queuelistmutex.enter();
if (mutexPointer != NULL &&
MutexList != NULL)
{
MutexList_t *temp = MutexList;
MutexList_t *prev = NULL;
while (temp != NULL)
{
if (temp->mutexPointer == mutexPointer)
{
break;
}
prev = temp;
temp = temp->next;
}
if (prev == NULL)
{
MutexList = temp->next;
} else {
prev->next = temp->next;
}
delete temp;
queuelistmutex.exit();
}
}
示例3: JUCETaskResume
void JUCETaskResume(int taskID)
{
tasklistmutex.enter();
JUCETask *thistask;
thistask = taskArray[taskID];
tasklistmutex.exit();
if (thistask != NULL) thistask->startThread();
}
示例4: MutexList_Add
void MutexList_Add(CriticalSection *mutexPointer, int mutexID)
{
queuelistmutex.enter();
MutexList_t *root = MutexList;
MutexList_t *newentry = new MutexList_t;
newentry->mutexID = mutexID;
newentry->mutexPointer = mutexPointer;
newentry->next = root;
MutexList = newentry;
queuelistmutex.exit();
}
示例5: JUCETaskSuspend
void JUCETaskSuspend(int taskID)
{
tasklistmutex.enter();
JUCETask *thistask;
thistask = taskArray[taskID];
tasklistmutex.exit();
if (thistask != NULL)
{
if (Thread::getCurrentThreadId() != thistask->getThreadId())
{
thistask->stopThread(5000);
}
else thistask->signalThreadShouldExit();
}
}
示例6: JUCETaskResumeAll
void JUCETaskResumeAll(void)
{
tasklistmutex.enter();
JUCETask *thistaskArray[MAX_JUCETASKS];
for (unsigned int i = 0; i < MAX_JUCETASKS; i++)
{
thistaskArray[i] = taskArray[i];
}
tasklistmutex.exit();
for (unsigned int i = 0; i < MAX_JUCETASKS; i++)
{
if (thistaskArray[i] != NULL)
{
thistaskArray[i]->startThread();
}
}
}
示例7: MutexListList_GetID
int MutexListList_GetID(CriticalSection *mutexPointer)
{
queuelistmutex.enter();
MutexList_t *temp = MutexList;
int returnID = -1;
while (temp != NULL)
{
if (temp->mutexPointer == mutexPointer)
{
returnID = temp->mutexID;
break;
}
temp = temp->next;
}
queuelistmutex.exit();
return returnID;
}
示例8:
CriticalSection *MutexList_GetPointer(int mutexID)
{
queuelistmutex.enter();
MutexList_t *temp = MutexList;
CriticalSection *returnPointer = NULL;
while (temp != NULL)
{
if (temp->mutexID == mutexID)
{
returnPointer = temp->mutexPointer;
break;
}
temp = temp->next;
}
queuelistmutex.exit();
return returnPointer;
}
示例9: JUCETaskSuspendAll
void JUCETaskSuspendAll(void)
{
tasklistmutex.enter();
JUCETask *thistaskArray[MAX_JUCETASKS];
for (unsigned int i = 0; i < MAX_JUCETASKS; i++)
{
thistaskArray[i] = taskArray[i];
}
tasklistmutex.exit();
for (unsigned int i = 0; i < MAX_JUCETASKS; i++)
{
if (thistaskArray[i] != NULL)
{
if ( Thread::getCurrentThreadId() != thistaskArray[i]->getThreadId() )
{
thistaskArray[i]->stopThread(5000);
}
}
}
}
示例10: mouseDown
void TrackComponent::mouseDown(const MouseEvent &e) {
ModifierKeys modifiers = ModifierKeys::getCurrentModifiersRealtime();
int posX;
// check the mod keys ..
if (modifiers.isPopupMenu() || modifiers.isCtrlDown())
{
ScopedPointer<PopupMenu> trackMenu_ = new PopupMenu();
trackMenu_->clear();
trackMenu_->addCommandItem(&_commands, MainWindow::showMixer);
trackMenu_->addItem(1, "Add Region", true);
MouseEvent ev = e.getEventRelativeTo(this);
for(auto region : _regionComponents)
{
posX = ev.x;
region->setBroughtToFrontOnMouseClick(true);
if(region->getPositionX() < posX && posX < (region->getPositionX() + region->getRegionWidth()))
{
trackMenu_->addItem(2, "Remove Region", true);
}
}
switch (trackMenu_->show())
{
case 1:
{
FileChooser chooser("Select an audio file to add...",
File::nonexistent,
"*.wav; *aif; *.flac");
if (chooser.browseForFileToOpen()) {
File audioFile(chooser.getResult());
const String fileString = audioFile.getFullPathName();
String format;
if (fileString.contains(".wav"))
format = "WAV";
else if (fileString.contains(".aif") || fileString.contains(".aiff"))
format = "AIFF";
else if (fileString.contains(".flac"))
format = "FLAC";
AudioFormatManager formatManager;
formatManager.registerBasicFormats();
AudioFormatReader* reader = formatManager.createReaderFor(audioFile);
Audio::Region* region = new Audio::SampleRegion(reader, 1, &audioFile);
Point<int> position = e.getPosition();
int x = position.getX();
if (x > _mixerOffset)
{
int64 samplesRange = secondsToSamples(100, _sampleRate);
int64 positionSamples = pixelsToSamples(x - _mixerOffset, 100 * _pixelsPerClip, samplesRange);
_track->add(positionSamples, region);
createRegionGUI(x, region, formatManager, audioFile);
getParentComponent()->resized();
}
else if (x < _mixerOffset)
{
_track->add(0, region);
createRegionGUI(_mixerOffset, region, formatManager, audioFile);
getParentComponent()->resized();
}
}
}
break;
case 2:
{
CriticalSection critical;
critical.enter();
for(size_t i = 0; i < _regionComponents.size(); ++i)
{
Rectangle<int> bounds_ = _regionComponents.at(i)->getBounds();
posX = ev.x;
if((int)_regionComponents.at(i)->getPositionX() < posX && posX < ((int)_regionComponents.at(i)->getPositionX() + (int)_regionComponents.at(i)->getRegionWidth()))
{
_track->remove(_regionComponents.at(i)->getRegion(), _posX.at(i));
std::vector<RegionComponent*>::iterator regit = _regionComponents.begin() + i;
RegionComponent* component = _regionComponents.at(i);
removeChildComponent(_regionComponents.at(i));
_regionComponents.erase(regit);
delete component;
_regions.erase(_posX.at(i));
std::vector<int64>::iterator posit = _posX.begin() + i;;
_posX.erase(posit);
std::vector<int64>::iterator sampsit = _sizeSamps.begin() + i;;
_sizeSamps.erase(sampsit);
}
}
critical.exit();
}
default:
break;
}
}
}