From 223388f1ad8f3e39856a1e6a01ef2acd1d820d25 Mon Sep 17 00:00:00 2001 From: Georg Holzmann Date: Mon, 14 Nov 2005 21:06:04 +0000 Subject: initial commit svn path=/trunk/externals/grh/; revision=3898 --- threadlib/README | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 threadlib/README (limited to 'threadlib/README') diff --git a/threadlib/README b/threadlib/README new file mode 100755 index 0000000..54850f1 --- /dev/null +++ b/threadlib/README @@ -0,0 +1,65 @@ +threadlib +PD library for threaded patching +heavily based on pd_devel code by Tim Blechmann +(c) 2005, Georg Holzmann, +http://grh.mur.at/software/threadlib.html + +------------------------------------------------------------------------ + +contents of threadlib: + detach run part of the patch in a helper thread + join synchronize messages to pd's main thread + sleep blocks the system for a specific time + threadedsf modified threaded soundfiler from pd_devel_0.38 + +WARNING: +these objects (especially detach/join) are very experimental and may +crash your patches if you use them in the wrong way, because some +externals/internals are not threadsafe! + +REQUIREMENT: pd >= 0.39 + +Many thanks to Tim Blechmann for his code and help! + +------------------------------------------------------------------------ + +detach: +Detach is working on control objects only, creates a helper thread +and runs all functions of the following objects in this helper thread. +If a message from that thread reaches a join object a callback for +running the outlet function will be placed in the scheduler and run in +the next scheduler loop - so you can synchronize the message with pd's +main thread again. +Detach is useful if you have a control operation that would be too +CPU-intensive and would disturb dsp. + +join: +The message to the inlet will be sent to the outlet during the +next clock callback of the scheduler. It doesn't matter, which thread +the message was coming from. Messages from the main pd thread will be +rescheduled. +Join can be used everywhere, where a message has to be rescheduled, this +is also useful to place behind any threaded external calling the outlet +functions from the helper thread, to make sure the following messages +are being run in the main pd thread. + +threadedsf: +This is the threaded soundfiler from pd devel 0.38 by Tim Blechmann, +adapted to work with main pd >= 0.39. +Instead of the idle callbacks, which are not really useable in current +main pd, it uses clock-callbacks (and also the lockfree FIFO of pd devel). + +!!! WARNING: !!! +detach/join provide the possibility of threaded patching. +beware of the risks: +- not every pd object is thread-safe (if unsure, look at the source +code or ask at the pd-list or me) +- pd is not completely thread-safe itself +- everything that is triggered by the detached message will be +detached. don't mix threaded and non-threaded message paths unless you +know what you are doing. use the join external to synchronize with the +main pd thread!!!! +- if detach/join crashes pd during a performance, don't complain ... +- both detach and join have an overhead ... so only use them, if you +really need threaded patching, e.g. have a subpatch that has to run for +quite some time and would interrupt audio or something else -- cgit v1.2.1