blob: 8d214151cc0a8616de9058c1e7e05baa26497733 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
//
// JASCmdStack
//
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/JAudio2/JASCmdStack.h"
#include "JSystem/JAudio2/JASCriticalSection.h"
#include "dolphin/os.h"
JASPortCmd::TPortHead JASPortCmd::sCommandListOnce;
JASPortCmd::TPortHead JASPortCmd::sCommandListStay;
bool JASPortCmd::addPortCmdOnce() {
JASCriticalSection cs;
return sCommandListOnce.append(this);
}
bool JASPortCmd::setPortCmd(Command func, JASPortArgs* args) {
JUT_ASSERT(81, func != 0);
if (getSupervisor()) {
return false;
}
mFunc = func;
mArgs = args;
return true;
}
void JASPortCmd::execAllCommand() {
sCommandListOnce.execCommandOnce();
sCommandListStay.execCommandStay();
}
void JASPortCmd::TPortHead::execCommandOnce() {
JASCriticalSection cs;
JSULink<JASPortCmd>* next;
for (JSULink<JASPortCmd>* link = getFirst(); link != NULL; link = next) {
next = link->getNext();
JASPortCmd* cmd = link->getObject();
cmd->getFunc()(cmd->getArgs());
remove(link);
}
}
void JASPortCmd::TPortHead::execCommandStay() {
JASCriticalSection cs;
for (JSULink<JASPortCmd>* link = getFirst(); link != NULL; link = link->getNext()) {
JASPortCmd* cmd = link->getObject();
cmd->getFunc()(cmd->getArgs());
}
}
|