aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions/thread.cpp
diff options
context:
space:
mode:
authorjohndoe1232014-03-13 19:55:25 +0100
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit9d35f807ecc0cbc7a98a987c02d58d795706ed1f (patch)
treed92c9e062265b56d2c2797d39f950494b83530ac /engines/illusions/thread.cpp
parent9696eb9a546891bf7ff601d94f7a8a2ff6730349 (diff)
downloadscummvm-rg350-9d35f807ecc0cbc7a98a987c02d58d795706ed1f.tar.gz
scummvm-rg350-9d35f807ecc0cbc7a98a987c02d58d795706ed1f.tar.bz2
scummvm-rg350-9d35f807ecc0cbc7a98a987c02d58d795706ed1f.zip
ILLUSIONS: More work on the script system
Diffstat (limited to 'engines/illusions/thread.cpp')
-rw-r--r--engines/illusions/thread.cpp43
1 files changed, 33 insertions, 10 deletions
diff --git a/engines/illusions/thread.cpp b/engines/illusions/thread.cpp
index 8c2f585360..0bfb82e5cd 100644
--- a/engines/illusions/thread.cpp
+++ b/engines/illusions/thread.cpp
@@ -27,8 +27,31 @@ namespace Illusions {
// Thread
-Thread::Thread(IllusionsEngine *vm)
- : _vm(vm), _pauseCtr(0), _terminated(false) {
+Thread::Thread(IllusionsEngine *vm, uint32 threadId, uint32 callingThreadId, uint notifyFlags)
+ : _vm(vm), _threadId(threadId), _callingThreadId(callingThreadId), _notifyFlags(notifyFlags),
+ _pauseCtr(0), _terminated(false) {
+}
+
+Thread::~Thread() {
+}
+
+int Thread::onUpdate() {
+ return kTSTerminate;
+}
+
+void Thread::onSuspend() {
+}
+
+void Thread::onNotify() {
+}
+
+void Thread::onPause() {
+}
+
+void Thread::onResume() {
+}
+
+void Thread::onTerminated() {
}
void Thread::pause() {
@@ -65,15 +88,15 @@ void Thread::notify() {
int Thread::update() {
// NOTE Deletion of terminated threads handled in caller
- int result = 2;
+ int status = kTSYield;
if (!_terminated && _pauseCtr <= 0) {
- result = onUpdate();
- if (result == 1)
+ status = onUpdate();
+ if (status == kTSTerminate)
terminate();
- else if (result == 3)
+ else if (status == kTSSuspend)
suspend();
}
- return result;
+ return status;
}
void Thread::terminate() {
@@ -111,9 +134,9 @@ void ThreadList::updateThreads() {
it = _threads.erase(it);
delete thread;
} else {
- int updateResult = 4;
- while (!thread->_terminated && updateResult != 1 && updateResult != 2)
- updateResult = thread->update();
+ int status = kTSRun;
+ while (!thread->_terminated && status != kTSTerminate && status != kTSYield)
+ status = thread->update();
++it;
}
}