On Tue, 06 Sep 2016 06:42:23 GMT, Jack Applegame wrote:

On Tue, 06 Sep 2016 00:28:57 GMT, Alexey Kulentsov wrote:

On Sun, 04 Sep 2016 16:45:43 GMT, Alexey Kulentsov wrote:
Ok, I resolve it, but it was not good time.
http://vibed.org/api/vibe.http.server/HTTPServerResponse.waitForConnectionClose
I tried to use this function to close my service threads on HTTP connection close. It was a bad idea because when this function running, you can't write to response bodyWriter. I found in documentation nothing about this exclusive usage.
I'm pretty sure that sharing the connection between the tasks is impossible.

It's not about sharing connection, because when I replace waitForConnectionClose() for explicit waiting loop then problem disappears. Now this method looks like:

void setExitByHTTPClose(HTTPServerResponse response)
{
	runTask((){
			while(response.connected())
				sleep(5.seconds);
			if(stillRunning)
				writer.send(WriterCommand.JustExit);
	});
}