Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Darwin | |
| // Call proc_listallpids once with nil/0 args to get the current number of pids | |
| let initialNumPids = proc_listallpids(nil, 0) | |
| // Allocate a buffer of these number of pids. | |
| // Make sure to deallocate it as this class does not manage memory for us. | |
| let buffer = UnsafeMutablePointer<pid_t>.allocate(capacity: Int(initialNumPids)) | |
| defer { | |
| buffer.deallocate() |