Re:Wangle – an asynchronous C++ networking and RPC library
by jhartmann on Wednesday April 20, 2016 @01:32PM
(#11536121)
The wangle native way of doing this is just to use an IOThreadPoolExecutor: https://github.com/facebook/wangle/blob/master/wangle/concur...
Just make a block of threads to run your db tasks, and you can use a promise/future to return the results back to the async code.
Re:Wangle – an asynchronous C++ networking and RPC library
by malkia on Wednesday April 20, 2016 @01:28PM
(#11536080)
> Emulating asynchronous execution with a thread is ok too
Straying away from the topic, but I used to support a file streaming library for the game studio I worked with, and while this approach worked, some things were not gracefully handled - for example canceling reading in the middle, or somehow giving all your I/O requests to the underlying system, so it can decide what's the best way to read them (aio?).
Re:Wangle – an asynchronous C++ networking and RPC library
by fredemmott on Wednesday April 20, 2016 @02:13PM
(#11536470)
There's https://github.com/facebook/squangle for MySQL, though it's lacking documentation, and requires a https://github.com/facebook/mysql-5.6 or WebScaleSQL client library
Re:Wangle – an asynchronous C++ networking and RPC library
by jcoffland on Thursday April 21, 2016 @03:14AM
(#11540183)
MariaDB has an asynchronous C API.
Re:Wangle – an asynchronous C++ networking and RPC library
by infinite8s on Thursday April 21, 2016 @07:53AM
(#11541304)
libpq (Postgres's client library) has an asynchronous interface as well.
Usually synchronous database drivers have to be reimplemented in an asynchronous fashion to work with event loops. It's not very hard though, could be as simple as adding jump tables and context structures into synchronous functions.
Emulating asynchronous execution with a thread is ok too. You do that to access filesystem anyway.
But if your first thought is about accessing a database server - you probably don't need to go asynchronous at all.