LamourBt / SwiftConcurrent

Easy Interface to deal with multiple queues and Synchronization in swift on macOS and linux.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwiftConcurrent

Easy Interface to deal with multiple queues and Synchronization in swift on macOS and linux.

Example Create a pool of Thread

let pool = GCDPooling(quantity: 2)
// as of now you have 2 global queues within your pool

pool.runOnto(queueAtIndex: 0, completion: {
  print("First Queue Working Hard")
})

pool.runOnto(queueAtIndex: 1, completion: {
  print("Second Queue Working Hard")
})

// runOnto method is how we place computation within a queue within our pool

pool.notify {
  print("fini...")
}
// notify would be invoked when all jobs have been completed.

Lock block code

let sema = Semaphore(numberOfOps: 1)
// Sempahore is a nice wrapper around DispatchSemaphore

sema.lock {
  print("placed important block of code")
}
// lock places your code in between both wait & signal

Questions & Concerns/Issues

Just Open an issue.

Contributing

Just send a PR! We don't bite ;)

About

Easy Interface to deal with multiple queues and Synchronization in swift on macOS and linux.


Languages

Language:Swift 97.5%Language:Makefile 2.5%