vibed - blocking file I/O via library?

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 6 08:45:43 PDT 2015


So a very basic question about using vibed for a REST service.  I 
am serving data using REST to another application.  For the time 
being it is internal so it is not a disaster if the fiber blocks. 
  But I wanted to understand what I should be doing - the small 
server app calls library code to retrieve data for a selected 
series from a large data store (several files, each up to 45G).  
This library code uses the standard C/posix APIs for file I/O so 
isn't written with asynchronous access in mind

What do I need to do to make sure that if the library code to 
retrieve the data takes a long time to return that the whole 
vibed event loop does not block?  Should I start a worker task on 
another thread and wait for it to return?  Or will vibed start 
another thread to serve a new incoming connection if I am still 
waiting for data in the meantime.


Thanks.


Laeeth,


More information about the Digitalmars-d-learn mailing list