Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 608 Bytes

README.md

File metadata and controls

24 lines (15 loc) · 608 Bytes

Overview

Strand is a simple Swift wrapper for pthread. I put this together to avoid working with libdispatch on Linux. Libdispatch has some complicated macros that aren't imported nicely as a C module, particularly around concurrent queues. Strand makes concurrent operations easy.

Usage

When you create a new Strand instance a new thread is created immediately. You can join, cancel, or just ignore the resulting instance. The thread will run as expected.

var data: String?

let s = try Strand {
    data = "hi~"
}

try s.join()

print(data) // Prints Optional("Hi~")

License

MIT