<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>Am 05.09.2007 um 22:04 schrieb Claude Heiland-Allen:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Yes, I remember, with different return codes from the hook for "I'm done" and "I have more to do" (and also "I did nothing"?).</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I also think there should be a better mechanism for registering hooks, that also allows unregistering hooks later.<SPAN class="Apple-converted-space">  </SPAN>Example:</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><BLOCKQUOTE type="cite"><FONT class="Apple-style-span" color="#000000"><BR class="khtml-block-placeholder"></FONT><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">1. X stores existing loader hook W, registers hook X</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">2. Y stores existing loader hook X, registers hook Y</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">3. X wants to remove hook, so restores loader hook to W</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">4. Y no longer has its hook registered =&gt; badness</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>In Miller's pd the sys_idlehook is meant to be modified primarily on class setup - unregistering is not possible as you outlined. In the devel branch, there's a threadsafe sys_callback function to do this.<BR><DIV>Return value 0 (i'm done) for a registered idle callback function would unregister the hook.</DIV><DIV>Have a look at our paper on your pdconf usb stick.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Something like a priority queue of hooks would be useful, but then you're in the realm of implementing a multitasking scheduler....</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>It's not undoable but then again it might be more useful to use separate threads with adjustable priorities and use fifo queues and idle processing for communication with the pd kernel. That's how it is done in vibrez.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>greetings, Thomas</DIV></DIV><BR></BODY></HTML>