Hi, I have this little project (mod-swift.org) in which I embed Swift into Apache. I’m trying to understand the implications of hosting GCD Swift code inside an Apache process&thread. Though I guess those are pretty generic questions.
- Can I create a concurrent queue from within an external thread and dispatch blocks to that (and then use a barrier or semaphore to wait on completion)? - Is the external thread in any way touched by GCD? Would it somehow automatically create a serial queue for it? Or reuse the thread for queues created from it? - What would accessing DispatchQueue.main mean in such a context? Is this attaching a serial queue to the first thread invoking it? What I essentially want is this: let workerQueue = DispatchQueue(label: “sync->async->sync", attributes: DispatchQueue.Attributes.concurrent) func doSomethingAsyncAndWait(@esc cb: (@esc done:()->())->()) { var done = DispatchSemaphore(value: 0) workerQueue.async { cb() { done.signal() } } done.wait() } Is there anything I need to consider when doing this? Thanks a lot! Helge
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users