Skip to content

PlanTeam/Strand

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simple Swift pthread wrapper

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 86.8%
  • Objective-C 13.2%