From 99a29c1926eee84f100ad9ea59a8c33f7878c342 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sun, 22 Dec 2002 01:28:34 +0000 Subject: "no message" svn path=/trunk/; revision=306 --- externals/grill/flext/tutorial/maxmsp/ex-thread1 | Bin 0 -> 1004 bytes externals/grill/flext/tutorial/maxmsp/ex-thread2 | Bin 0 -> 874 bytes externals/grill/flext/tutorial/pd/ex-thread1.pd | 86 +++++++++++----------- externals/grill/flext/tutorial/readme.txt | 2 +- externals/grill/flext/tutorial/thread1/main.cpp | 8 +- externals/grill/flext/tutorial/thread1/thread1.cw | Bin 68426 -> 68426 bytes externals/grill/flext/tutorial/thread2/main.cpp | 18 ++--- externals/grill/flext/tutorial/thread2/thread2.cw | Bin 68426 -> 68426 bytes 8 files changed, 58 insertions(+), 56 deletions(-) create mode 100755 externals/grill/flext/tutorial/maxmsp/ex-thread1 create mode 100755 externals/grill/flext/tutorial/maxmsp/ex-thread2 (limited to 'externals/grill/flext/tutorial') diff --git a/externals/grill/flext/tutorial/maxmsp/ex-thread1 b/externals/grill/flext/tutorial/maxmsp/ex-thread1 new file mode 100755 index 00000000..cd204b4a Binary files /dev/null and b/externals/grill/flext/tutorial/maxmsp/ex-thread1 differ diff --git a/externals/grill/flext/tutorial/maxmsp/ex-thread2 b/externals/grill/flext/tutorial/maxmsp/ex-thread2 new file mode 100755 index 00000000..d68690c4 Binary files /dev/null and b/externals/grill/flext/tutorial/maxmsp/ex-thread2 differ diff --git a/externals/grill/flext/tutorial/pd/ex-thread1.pd b/externals/grill/flext/tutorial/pd/ex-thread1.pd index 67d673db..341bcc37 100644 --- a/externals/grill/flext/tutorial/pd/ex-thread1.pd +++ b/externals/grill/flext/tutorial/pd/ex-thread1.pd @@ -1,43 +1,43 @@ -#N canvas 105 266 700 343 12; -#X obj 39 91 bng 25 250 50 0 empty empty start 0 -6 32 8 -261681 -1 --1; -#X obj 39 244 thread1; -#X obj 130 246 thread1; -#X obj 220 247 thread1; -#X obj 312 247 thread1; -#X obj 405 247 thread1; -#X obj 131 185 delay 200; -#X obj 220 184 delay 200; -#X obj 313 186 delay 200; -#X obj 404 185 delay 200; -#X text 78 85 click to start; -#X text 126 103 (if you click twice \, the same thread is started a -second time); -#X obj 16 8 cnv 15 550 40 empty empty thread1 10 22 32 24 -260818 -1 -0; -#X text 175 8 flext tutorial \, (C)2002 Thomas Grill; -#X text 175 28 http://www.parasitaere-kapazitaeten.net; -#X obj 39 277 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32 12 --228992 -1 -1 0 256; -#X obj 131 277 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32 -12 -228992 -1 -1 0 256; -#X obj 221 277 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32 -12 -228992 -1 -1 0 256; -#X obj 311 277 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32 -12 -228992 -1 -1 0 256; -#X obj 406 276 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32 -12 -228992 -1 -1 0 256; -#X connect 0 0 1 0; -#X connect 0 0 6 0; -#X connect 1 0 15 0; -#X connect 2 0 16 0; -#X connect 3 0 17 0; -#X connect 4 0 18 0; -#X connect 5 0 19 0; -#X connect 6 0 2 0; -#X connect 6 0 7 0; -#X connect 7 0 3 0; -#X connect 7 0 8 0; -#X connect 8 0 4 0; -#X connect 8 0 9 0; -#X connect 9 0 5 0; +#N canvas 105 266 702 345 12; +#X obj 39 91 bng 25 250 50 0 empty empty start 0 -6 0 8 -261681 -1 +-1; +#X obj 130 246 thread1; +#X obj 220 247 thread1; +#X obj 312 247 thread1; +#X obj 405 247 thread1; +#X obj 131 185 delay 200; +#X obj 220 184 delay 200; +#X obj 313 186 delay 200; +#X obj 404 185 delay 200; +#X text 78 85 click to start; +#X text 126 103 (if you click twice \, the same thread is started a +second time); +#X obj 16 8 cnv 15 550 40 empty empty thread1 10 22 0 24 -260818 -1 +0; +#X text 175 8 flext tutorial \, (C)2002 Thomas Grill; +#X text 175 28 http://www.parasitaere-kapazitaeten.net; +#X obj 131 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 +12 -228992 -1 -1 0 256; +#X obj 221 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 +12 -228992 -1 -1 0 256; +#X obj 311 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 +12 -228992 -1 -1 0 256; +#X obj 406 276 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 +12 -228992 -1 -1 0 256; +#X obj 39 244 thread1; +#X obj 39 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 +12 -228992 -1 -1 0 256; +#X connect 0 0 5 0; +#X connect 0 0 18 0; +#X connect 1 0 14 0; +#X connect 2 0 15 0; +#X connect 3 0 16 0; +#X connect 4 0 17 0; +#X connect 5 0 1 0; +#X connect 5 0 6 0; +#X connect 6 0 2 0; +#X connect 6 0 7 0; +#X connect 7 0 3 0; +#X connect 7 0 8 0; +#X connect 8 0 4 0; +#X connect 18 0 19 0; diff --git a/externals/grill/flext/tutorial/readme.txt b/externals/grill/flext/tutorial/readme.txt index fa86a5ce..3e7004a1 100644 --- a/externals/grill/flext/tutorial/readme.txt +++ b/externals/grill/flext/tutorial/readme.txt @@ -39,7 +39,7 @@ o Metrowerks CodeWarrior V6: edit & use the several ".cw" project files Max/MSP - MacOSX: ------------------ -... sorry, not yet... would someone please donate me a CodeWarrior V8 ? +o Metrowerks CodeWarrior V6: edit & use the several ".cw" project files ---------------------------------------------------------------------------- diff --git a/externals/grill/flext/tutorial/thread1/main.cpp b/externals/grill/flext/tutorial/thread1/main.cpp index 72fb1019..f5e2a651 100644 --- a/externals/grill/flext/tutorial/thread1/main.cpp +++ b/externals/grill/flext/tutorial/thread1/main.cpp @@ -37,7 +37,7 @@ protected: void m_start(); // method function private: - // define threaded callback for method m_start (with boolean argument) + // define threaded callback for method m_start // the same syntax as with FLEXT_CALLBACK is used here FLEXT_THREAD(m_start); }; @@ -64,17 +64,19 @@ void thread1::m_start() for(int i = 0; i < 20 && !ShouldExit(); ++i) { ToOutInt(0,i); // output loop count +// post("%i",i); // wait for half a second for(int j = 0; j < 5 && !ShouldExit(); ++j) Sleep(0.1f); // note: we shall not block a thread for a longer time. // The system might want to destroy the object in the meantime and - // expects thread termination. - // Flext waits for 1 second by default, then it aborts the thread brutally + // expects thread termination. In such a case flext waits + // for 1 second by default, then it aborts the thread brutally } // output a final zero ToOutInt(0,0); +// post("end"); } diff --git a/externals/grill/flext/tutorial/thread1/thread1.cw b/externals/grill/flext/tutorial/thread1/thread1.cw index f971d4a3..680bdfba 100644 Binary files a/externals/grill/flext/tutorial/thread1/thread1.cw and b/externals/grill/flext/tutorial/thread1/thread1.cw differ diff --git a/externals/grill/flext/tutorial/thread2/main.cpp b/externals/grill/flext/tutorial/thread2/main.cpp index bd6354a2..2cdc37c3 100644 --- a/externals/grill/flext/tutorial/thread2/main.cpp +++ b/externals/grill/flext/tutorial/thread2/main.cpp @@ -88,18 +88,18 @@ void thread2::m_start(int st) ToOutInt(0,count); // output loop count } - cond.Lock(); // lock conditional running = false; // change state flag - cond.Signal(); // signal changed flag to watiting "stop" method - cond.Unlock(); // unlock conditional +// cond.Lock(); // lock conditional + cond.Signal(); // signal changed flag to waiting "stop" method +// cond.Unlock(); // unlock conditional } void thread2::m_stop() { - cond.Lock(); // lock conditional +// cond.Lock(); // lock conditional stopit = true; // set termination flag - while(*(&running) || *(&blipping)) // workaround for CodeWarrior! + while(*(&running) || *(&blipping)) // workaround for CodeWarrior (doesn't honor volatile modifier!) { cond.Wait(); // wait for signal by running threads } @@ -107,7 +107,7 @@ void thread2::m_stop() // --- Here, the threads should have stopped --- stopit = false; // reset flag - cond.Unlock(); // unlock conditional +// cond.Unlock(); // unlock conditional } @@ -126,9 +126,9 @@ void thread2::m_textout() Sleep(1.f); } - cond.Lock(); // lock conditional blipping = false; // change state flag - cond.Signal(); // signal changed flag to watiting "stop" method - cond.Unlock(); // unlock conditional +// cond.Lock(); // lock conditional + cond.Signal(); // signal changed flag to waiting "stop" method +// cond.Unlock(); // unlock conditional } diff --git a/externals/grill/flext/tutorial/thread2/thread2.cw b/externals/grill/flext/tutorial/thread2/thread2.cw index af968e69..524ad776 100755 Binary files a/externals/grill/flext/tutorial/thread2/thread2.cw and b/externals/grill/flext/tutorial/thread2/thread2.cw differ -- cgit v1.2.1