diff options
author | Georg Holzmann <grholzi@users.sourceforge.net> | 2005-11-14 21:06:04 +0000 |
---|---|---|
committer | Georg Holzmann <grholzi@users.sourceforge.net> | 2005-11-14 21:06:04 +0000 |
commit | 223388f1ad8f3e39856a1e6a01ef2acd1d820d25 (patch) | |
tree | 41578c263250ccb3f815b279d4091d2721089341 /threadlib/doc/help-sleep.pd | |
parent | 406758342ee046707e5426f804c7b381a0728335 (diff) |
initial commit
svn path=/trunk/externals/grh/; revision=3898
Diffstat (limited to 'threadlib/doc/help-sleep.pd')
-rwxr-xr-x | threadlib/doc/help-sleep.pd | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/threadlib/doc/help-sleep.pd b/threadlib/doc/help-sleep.pd new file mode 100755 index 0000000..b9c172d --- /dev/null +++ b/threadlib/doc/help-sleep.pd @@ -0,0 +1,88 @@ +#N canvas 280 37 465 589 10; +#X obj 29 23 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 +; +#X obj 31 25 cnv 15 400 50 empty empty threadlib 22 25 0 18 -228992 +-66577 0; +#X text 322 34 help file of; +#X text 27 518 =%)!(%= threadlib \, by Georg Holzmann <grh@mur.at> +\, 2005; +#X text 70 552 htttp://grh.mur.at/software/threadlib.html; +#X obj 261 452 threadedsf; +#X text 83 452 see also:; +#X text 55 535 heavily based on pd_devel code by Tim Blechmann; +#N canvas 421 0 803 576 detach_join_examples 0; +#X msg 117 105 5; +#X obj 117 133 sleep; +#X text 37 39 1) this will block the system for 5 sec:; +#X obj 117 161 print EX1_DONE; +#X text 554 112 (instead of sleep you could; +#X msg 499 73 5; +#X obj 499 123 sleep; +#X text 396 39 2) to avoid this you can run it in a helper thread: +; +#X obj 499 97 detach; +#X obj 499 184 print EX2_DONE; +#X text 560 127 of course use an other cpu; +#X text 559 143 intensive object which could; +#X text 561 158 block the main thread); +#X text 34 252 3) be aware that each object connected to; +#X text 55 267 detach will run in the helper thread:; +#X msg 127 305 5; +#X obj 127 366 sleep; +#X obj 127 330 detach; +#X obj 170 397 print EX3_DONE_1; +#X msg 127 396 5; +#X obj 127 433 sleep; +#X obj 127 514 print EX3_DONE_2; +#X text 179 436 <- also in helper thread; +#X text 164 457 (and anything else connected; +#X text 171 472 to objects which are connected; +#X text 172 487 to detach !); +#X text 392 251 4) to synchronize these objects with pd main thread +; +#X text 413 268 again you have to use the join object:; +#X text 58 56 (so you will get e.g. an 5 sec; +#X text 61 71 audio drop out !); +#X msg 503 303 5; +#X obj 503 364 sleep; +#X obj 503 328 detach; +#X msg 503 394 5; +#X obj 546 395 print EX4_DONE_1; +#X text 579 368 <- in helper thread; +#X obj 503 431 join; +#X obj 503 463 sleep; +#X obj 503 518 print EX4_DONE_2; +#X text 551 464 <- in main thread again; +#X text 551 481 (and will so block the system); +#X connect 0 0 1 0; +#X connect 1 0 3 0; +#X connect 5 0 8 0; +#X connect 6 0 9 0; +#X connect 8 0 6 0; +#X connect 15 0 17 0; +#X connect 16 0 18 0; +#X connect 16 0 19 0; +#X connect 17 0 16 0; +#X connect 19 0 20 0; +#X connect 20 0 21 0; +#X connect 30 0 32 0; +#X connect 31 0 33 0; +#X connect 31 0 34 0; +#X connect 32 0 31 0; +#X connect 33 0 36 0; +#X connect 36 0 37 0; +#X connect 37 0 38 0; +#X restore 135 372 pd detach_join_examples; +#X obj 163 452 detach; +#X text 319 50 ::: sleep :::; +#X text 176 109 ::: SLEEP :::; +#X text 31 149 Sleep simply uses the c-function sleep() and blocks +the system for a specific time.; +#X obj 122 256 sleep; +#X msg 122 226 5; +#X text 159 227 <- sleep time in seconds !; +#X obj 122 287 print SLEEP_OVER; +#X text 154 353 see more examples:; +#X obj 220 452 join; +#X connect 13 0 16 0; +#X connect 14 0 13 0; |