Monthly Archives: February 2016

C and Swift – strcpy

February 27, 2016 12 Comments

Below are some of the things I’ve needed to do recently, when interfacing with C code. Maybe these will be useful to someone. I’m trying to implement Unix-domain sockets in Swift, and it’s been kind

PThreads in Swift

February 20, 2016 12 Comments

Here’s some code that implements pthreads via swift.

class PTTask {
init () {
}
func run() -> Int32 {
let threadPtr = UnsafeMutablePointer.alloc(1)
let selfPtr = UnsafeMutablePointer.alloc(1)
selfPtr.memory = self
let attrPtr

Signal Handling with Swift – sigaction version

February 20, 2016 12 Comments

I need a pointer in my signal handler, so I need to use sigaction. The following doesn’t go quite all the way with this, but I think it’s a useful example.

func shandler(sig: Int32,

Signal Handling with Swift (1st Attempt)

February 18, 2016 12 Comments

I need a high precision timer queue. I’m looking at standard *nix ways of implementing some of this – setitimer in particular. In preparation I wrote a very simple console swift app to test out