|
|
|
@ -1,15 +1,22 @@
|
|
|
|
|
# procmon
|
|
|
|
|
|
|
|
|
|
procmon is a small Go program for OSX that watches App launch and terminate
|
|
|
|
|
events in AppKit. The Go program directly links against the
|
|
|
|
|
events in AppKit. This project demonstrates the following useful techniques:
|
|
|
|
|
|
|
|
|
|
- how to call C code from Go with cgo
|
|
|
|
|
- how to link Apple frameworks into a cgo project
|
|
|
|
|
- how to call Go code from C
|
|
|
|
|
- how to integrate the callback-based concurrency model of AppKit into Go's CSP-style concurrency model
|
|
|
|
|
|
|
|
|
|
The Go program directly links against the
|
|
|
|
|
[AppKit](https://developer.apple.com/reference/appkit) framework and uses it to
|
|
|
|
|
subscribe to the
|
|
|
|
|
[NSNotificationCenter](https://developer.apple.com/reference/foundation/nsnotificationcenter)
|
|
|
|
|
notifications generated by the OS when the user launches or terminates an App.
|
|
|
|
|
The observer itself is writing in Objective-C. The Objective-C observer is
|
|
|
|
|
accessed through a simple C function that may be accessed by a Go program. The
|
|
|
|
|
Objective-C observer, upon seeing notifications, invokes a Go function
|
|
|
|
|
directly, passing control back to our Go program.
|
|
|
|
|
The observer itself is written in Objective-C. The Objective-C observer is
|
|
|
|
|
accessed by the Go program through a simple C function. The Objective-C
|
|
|
|
|
observer, upon seeing notifications, invokes a Go function directly, passing
|
|
|
|
|
control back to our Go program.
|
|
|
|
|
|
|
|
|
|
## installation
|
|
|
|
|
|
|
|
|
|