Closed fisherjoe closed 6 years ago
You have to call .lock()
before calling signal or wait, followed by .unlock()
.
It's described more in this document:
https://www.perfect.org/docs/thread.html
@kjessup Awesome, you are right. I have achieved it as follow: let event = Threading.Event(); event.lock(); Threading.dispatch { event.lock() Threading.sleep(seconds: 3) print("------->") event.signal() event.unlock() }
let wait = event.wait();
event.unlock();
When I use Theading as follow. My expected printed message is 『Do something first!』『After do something!』,but the result runing is opposite. Is there anything wrong about Threading ? And How could I perform in main thread?
func handler(request: HTTPRequest, response: HTTPResponse) {
}