1 // Cleanup functions are passed a flag.
2 // The flag is set false if nodes have already been freed by CmdPeriod
3 // This caused a minor change to TempoClock:clear and TempoClock:cmdPeriod
6 var <>functions; // cleanup functions from child streams and parent stream
7 *new { ^super.new.clear }
10 functions = IdentitySet.new;
13 addFunction { |event, function |
14 if(event.isKindOf(Dictionary)) {
15 functions = functions.add(function);
16 event[\addToCleanup] = event[\addToCleanup].add(function);
20 addNodeCleanup { |event, function |
21 if(event.isKindOf(Dictionary)) {
22 functions = functions.add(function);
23 event[\addToNodeCleanup] = event[\addToNodeCleanup].add(function);
28 if(event.isKindOf(Dictionary)) {
29 functions = functions.addAll(event[\addToNodeCleanup]);
30 functions = functions.addAll(event[\addToCleanup]);
31 functions = functions.removeAll(event[\removeFromCleanup]);
36 exit { | event, freeNodes = true |
37 if(event.isKindOf(Dictionary)) {
39 functions.do(_.value(freeNodes) );
40 event[\removeFromCleanup] = event[\removeFromCleanup].addAll(functions);
46 terminate { | freeNodes = true |
47 functions.do(_.value(freeNodes));