mhogomchungu / tasks Goto Github PK
View Code? Open in Web Editor NEWasync programming in Qt/C++ using tasks,continuations and resumable functions
License: Other
async programming in Qt/C++ using tasks,continuations and resumable functions
License: Other
Hey @mhogomchungu Asante sana for writing this particular library since task management is something that has been missing for Qt and all the other attempts made online were not doing it like the way we have always desired. Your solution seems to address the Async Wait via Task::await().
Now I may want to show my users progress in terms of a progress bar or percentage. Would you mind considering adding that for me please.
Does it support windows? Why can't I compile under windows?
It would be nice to put a series of async calls to compose a indexed queue which, on complete, shoud execute a trigger. something like this:
Task::queue([] {
Task::run( fn1 ).then( use1 );
Task::run( fn2 ).then( use2 );
Task::run( fn3 ).then( use3 );
}).then( doSomething );
I believe this is better than a sequence of await() calls, because it would take advantage of using many threads as possible.
Hi,
This issue is, in essence, a reply to your comment on http://cukic.co/2016/01/17/asynqt-framework-making-qfuture-useful/
@Mnogo mchungu
I've seen the library (on reddit). It is interesting, especially the future class design,
but I have a few issues with it. I'll reply on github. :)For this library, I needed to use QFutures (would not be my first choice) and not roll out my own,
because I already have a QFuture-based library in which I want to use this code.
While the title of the issue sounds overly serious, there are a few potential problems
I see with the current version of your library.
tasks::future_impl<T, StartFunction, CancelFunction, GetFunction>
), and only if the user actually wants to save the future in a variable that can not be declared as auto
, perform the type-erasure and create tasks::future. Though, on the other hand, this would make the code much more difficult to maintain.The idea is really nice, and would be awesome to have a library like this for C++/Qt. (maybe some things should be in Qt like .then, but I don't expect we will see many improvements to QFuture unfortunately)
Cheers,
Ivan
p.s. I hope I didn't sound offputting - I sometimes do unwantingly sound negative, but I'm really not :)
In Visual Studio 2015 Update 3, the example for using Task::run and 'then' produces the error:
no suitable user-defined conversion from "Type" to "std::function<void ()>" exists
Task::run<QString>([]() {
return QString("hi");
}).then([](QString r) {
});
Can you add more support for when_all, when_any and when_seq?
Similar to this open source project:
https://github.com/Naios/continuable
https://naios.github.io/continuable/
I don't have much practice in installing libraries in qt. How is yours installed? It would be of great help to me for a project.
Thanks for reading me.
Hi,
When I creating a future that combines multiple functions like this:
auto bb = [](){
qDebug() << "run bb";
return 6 ; } ;
Task::run( bb,bb );
I found that the function call has an infinite recursion.
template< typename ... T >
Task::future< void >& run( std::function< void() >f,T ... t )
{
auto& e = _private_future< void >() ;
_private_add_task( e,std::move( f ),std::move( t ) ... ) ;
return e ;
}
template< typename ... T >
void _private_add_task( Task::future< void >& f,std::function< void() >&& e,T&& ... t )
{
_private_add_void( f,Task::run( std::move( e ) ),std::function< void() >( [](){} ) ) ;
_private_add_task( f,std::move( t ) ... ) ;
}
Task::run( std::move( e ) ) will call
Task::future< void >& run( std::function< void() >f,T ... t )
and Task::future< void >& run( std::function< void() >f,T ... t ) will call
_private_add_task
So circulate
My development environment is win7+VS2015
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.