Hi, all This week I've added new dthread-based APIs for the existing duda mariadb package. The new APIs are now much easier and more straight forward than the asynchronous ones. The programmer can now code in a synchronous manner while still benefit from the event-driven underneath of Monkey.
Taken mariadb->connect_async as an example, we need to pass two parameters: a mariadb connection instance conn, and a callback to be called when the connection is either successfully established or is failed in the middle. This will seperate the linear logic flow into fragments, which makes it bug prone and requires more carefully thinking before coding. With the newly introduced dthread-based API mariadb->connect, we can write code just like we do with the usual synchronous way. Just one parameter is passed to it and then we wait for the return value of the function to tell us whether the connection is successfully established and determine what to do next. Besides, we don't need a callback this time because the logic after connection established come right after mariadb->connect. Connection pooling support have also been added to dthread-based connection, just notice a pool can be either hosting async-based connections or dthread-based connections but not both. In order to demonstrate the usage of dthread and the new APIs of maraidb package, I rewrited the old mariadb_demo example and you may be interested about it, check mariadb_dthread <https://github.com/swpd/duda_mariadb_dthread> out. What's more, documentation for dthread and new APIs of mariadb package was updated. Everything follows roughly to the schedule. It's coming near to the final evaluation of GSoC 2014 and next week I will be preparing for it. And I've learned a lot during this exciting journey. Many thanks to edsiper, acidx and the Monkey community :-) Blog Post: http://blog-swpd.rhcloud.com/gsoc-2014-update-duda-io-coroutines-week-13/ Github Repo: https://github.com/swpd/duda/tree/mariadb_dthread https://github.com/swpd/duda_mariadb_dthread Best Regards, swpd
_______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
