본문 바로가기
#포트폴리오 [Portfolio]/SystemKit (오픈소스)

🗂 [Guide] SKProcessMonitor

by cy_mos 2022. 10. 24.
반응형

🗂 SKProcessMonitor

SKProcessMonitormacOS 운영체제 프로세스 (Process) 상태를 추적하여 Handling 할 수 있도록 기능을 제공합니다.

프로세스 (Process) 상태를 추적할 수 있는 상태 값은 아래와 같습니다.

  • 실행 (exec): Process Exec'd

  • 종료 (exit): Process Exited

  • 복제 (fork): Process Forked

Example Source

SKProcessMonitor 예제 소스코드는 아래와 같습니다.

let monitor = SKProcessMonitor(pid: 3447, fflag: .exit) { decriptor, flag, rawValue in
    print("Receive Process Monitor: \(decriptor), \(flag), \(rawValue)")
}

OperationQueue.main.addOperation(monitor)

// Advises the operation object that it should stop executing its task.
monitor.cancel()

License

Universal SystemKit is released under the MIT license. See LICENSE for details.


MIT License

Copyright (c) 2022 Universal-SystemKit

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
반응형

'#포트폴리오 [Portfolio] > SystemKit (오픈소스)' 카테고리의 다른 글

🗂 [Guide] SKSystem  (0) 2022.11.28
🗂 [Guide] SKAsyncOperation  (0) 2022.11.04
🗂 [Guide] SKSignal  (0) 2022.10.24
🗂 [Guide] SKPermission  (0) 2022.09.28
🗂 [Guide] SKFinderExtension  (0) 2022.09.18

댓글