1: ================================================================================ 2: 3: Smalltalk.KSU defineClass: #ShellProcessManager 4: superclass: #{Core.Object} 5: indexedType: #none 6: private: false 7: instanceVariableNames: 'processCollection ' 8: classInstanceVariableNames: 'defaultManager ' 9: imports: '' 10: category: '' 11: 12: ================================================================================ 13: 14: KSU.ShellProcessManager method for 'defaults' 15: 16: defaultInterfaceClass 17: 18: ^KSU.ShellInterface 19: 20: ------------------------------------------------------------ 21: 22: KSU.ShellProcessManager method for 'process management' 23: 24: exit: aPipedProcess 25: 26: self defaultInterfaceClass new exitProcess: aPipedProcess. 27: self processCollection remove: aPipedProcess 28: 29: ------------------------------------------------------------ 30: 31: KSU.ShellProcessManager method for 'process management' 32: 33: garbageCollect 34: 35: | garbageCollection markBlock sweepBlock | 36: garbageCollection := OrderedCollection new. 37: markBlock := 38: [self processCollection do: 39: [:aPipedProcess | 40: aPipedProcess allOwners 41: detect: [:anOwner | anOwner class = self defaultInterfaceClass] 42: ifNone: [garbageCollection add: aPipedProcess]]]. 43: sweepBlock := 44: [garbageCollection do: [:aPipedProcess | self exit: aPipedProcess]]. 45: markBlock value. 46: sweepBlock value 47: 48: ------------------------------------------------------------ 49: 50: KSU.ShellProcessManager method for 'accessing' 51: 52: processCollection 53: 54: processCollection ifNil: [processCollection := OrderedCollection new]. 55: ^processCollection 56: 57: ------------------------------------------------------------ 58: 59: KSU.ShellProcessManager method for 'process management' 60: 61: register: aPipedProcess 62: 63: self processCollection add: aPipedProcess 64: 65: ================================================================================ 66: 67: KSU.ShellProcessManager class 68: instanceVariableNames: 'defaultManager ' 69: 70: ================================================================================ 71: 72: KSU.ShellProcessManager class method for 'accessing' 73: 74: default 75: 76: defaultManager ifNil: [defaultManager := self new]. 77: ^defaultManager 78: 79: ------------------------------------------------------------ 80: 81: KSU.ShellProcessManager class method for 'process management' 82: 83: exit: aPipedProcess 84: 85: self default exit: aPipedProcess 86: 87: ------------------------------------------------------------ 88: 89: KSU.ShellProcessManager class method for 'process management' 90: 91: garbageCollect 92: 93: self default garbageCollect 94: 95: ------------------------------------------------------------ 96: 97: KSU.ShellProcessManager class method for 'process management' 98: 99: register: aPipedProcess 100: 101: self default register: aPipedProcess 102: 103: ================================================================================
This document was generated by KSU.TextDoclet on 2013/02/22 at 01:01:06.