[Swift-devel] Coding a server in Swift
Tim Armstrong
tim.g.armstrong at gmail.com
Mon May 9 09:38:06 CDT 2011
Hi All,
for SwiftR, I've been looking at trying to implement a multi-threaded
server in Swift, but haven't been quite sure how to go about it.
Basically I want to write something that sits in a loop, reading requests
from a named pipe on the file system, and forking off threads to handle the
request.
Something like:
iterate {
request = readData(inputFile) // block until data available
handleRequest(request) // do all the work in a new thread.
}
My problem is that my (shaky) understanding is that iterate has sequential
semantics - that all of the statements within the loop body must finish
before the next iteration of the loop starts, which would mean only one
request was processed at a time. Am I correct in my understanding? If so,
is there a workaround where I could get it to fork off threads like this?
- Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20110509/bc2ca705/attachment.html>
More information about the Swift-devel
mailing list