Hi!

I have 2 general questions on the implementation. Maybe someone could give brief answers or some links with explanation?

  1. vibe.d claims to have asynchronous I/O via fibers. As I understand it - this means the flow looks something like this. When we're handling a request we come to a certain point, where we need to e.g. query a record from DB. We issue an asynchronous request and call smth like yield, not to waste CPU time. Someone wakes us later, we check for the status of the request, and proceed if it's ready, or yield again otherwise.

So, it brings the question - in that case - who is responsible for calling yield? I assume if I'm not calling it myself, it should be called by the vibe.d functions. So, if I want to read from file - I shouldn't use readText, but should use some vibe.d yield-aware alternative. Is that the case?

  1. Suppose, I have a class instance with state - e.g. a cached value of something. In each request I check if the value should be updated, possibly update it and proceed using this value. How I should make it work in vibe.d? If I create a class instance in shared static this(), then as I understand, the instance is shared among all of the threads, so if I use the cached value without synchronization - it's a race. Is that so? How can I avoid it?