Home » Developing U++ » U++ Developers corner » [PROPOSAL]: AsyncQueue class (a single threaded synchronization tool) for U++ (Discussion about implementing a single threaded synchronization tool for handling non-blocking I/O.)
[PROPOSAL]: AsyncQueue class (a single threaded synchronization tool) for U++ [message #46072] |
Sun, 28 February 2016 19:47 |
Oblivion
Messages: 1091 Registered: August 2007
|
Senior Contributor |
|
|
Hello guys,
I don't really want to flood this forum with proposals every other day. But AsyncQueue is the last class I'll share with you before I publish the SSH package.
In fact AsyncQueue is what made the SSH package for U++ possible.
I'm uploading the package here.
New version is even simple and it uses callbacks,allows lambdas.
It also contains both the API docs and an article/tutorial covering the rationale, aim, features, highlights and usage of the AsyncQueue package.
AsyncQueue is actually a generic version of non-blocking/async interface first used in HttpRequest. (Then I used the same model in NetworkProxy package, which I am now refactoring using AsyncQueue)
Excerpt from the article:
Rationale
U++ provides a rich set of core classes, including synchronisation tools and primitives designed mainly with multithreading in mind. Considering the general trends in, and demands of, modern computing, this is perfectly reasonable, if not imperative. When done properly, multithreading can and usually does give the best performance/cost ratio with a negligable overhead. Hovewer, multithreading is not always the optimal solution, and has its own disadvantages. For one, it is relatively difficult to write and debug a multithreaded code, as multithreading bring in its own set of problems such as classic concurrency problems which must be taken care of with extreme caution. Hence the increase of complexity. Moreover, multithreading models does not always scale well. Not every asynchronous operation or applicaton requires, or benefits from multithreading. Enter AsyncQueue.
Aim
AsyncQueue helper class does not aspire to provide an alternative to the existing multithreading classes in U++. Rather it is meant to be a small addition to the arsenal of synchronisation tools in the Core package, providing through a standardized interface a simple yet flexible asynchronous model targeting single-threaded component and application development, including but not limited to common socket operations, where multithreading either is not desirable or can easily get costly.
...
Please take your time to read the article.
Package has a BSD license, so feel free to use/modify it.
What is lacking? Example, of course Its example code will be SSH package, I guess...
Any suggestions, bug reports, criticism is always welcome.
Regards,
Oblivion.
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Wed, 02 March 2016 20:18] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Mar 29 06:23:00 CET 2024
Total time taken to generate the page: 0.01319 seconds
|