[libmill] Re: Coroutines and blocking calls

  • From: Paul Banks <banks@xxxxxxxxxx>
  • To: libmill@xxxxxxxxxxxxx
  • Date: Sat, 13 Feb 2016 05:20:54 +0000

Oh,

Just read about Facebook/Percona's version of libmysql that uses non blocking 
sockets: https://github.com/webscalesql/webscalesql-5.6

MariaDB also seems to have a non-blocking client library that is likely 
compatible (We've used mariadb client with MySQL 5.5 for years for some boring 
dependency reasons). 

I guess it would be possible to use those directly in libmill coroutine, 
provided there is some way to wait on the result being ready for example if 
they expose the raw fd and you can use fdwait.

If you get something working let us know!

Paul

On 12 Feb 2016, at 23:22, Gonzalo Diethelm (Redacted sender 
"gonzalo.diethelm" for DMARC) <dmarc-noreply@xxxxxxxxxxxxx> wrote:

Hello,

I like libmill a lot. The fact that Martin is behind it is even better.

Question: can libmill be used to fire away several coroutines, where each 
coroutine issues (possibly) blocking calls?

For example, say I want to create 4 coroutines, each connecting to a 
different MySQL DB, running a query and returning the results (which will 
later be aggregated). Could this be done with a single process libmill 
program, running 4 coroutines, without any calls to mfork()? What would 
happen if the call to mysql_real_connect(), which internally issues socket 
calls, were to block?

Cheers,
Gonzalo Diethelm



Other related posts: