[Development] Contribution proposal: Dispatcher class
Björn Piltz
bjornpiltz at gmail.com
Thu Sep 25 14:45:03 CEST 2014
So let's all upvote https://bugreports.qt-project.org/browse/QTBUG-37253.
BTW, the way you've implemented the Dispatcher constructor is off. You
can't give it a parent from another thread. You should use
QObject::moveToThread() instead.
Björn
2014-09-25 14:14 GMT+02:00 Olivier Goffart <olivier at woboq.com>:
> On Saturday 20 September 2014 12:41:07 Yam Marcovic wrote:
> > Hello,
> >
> > In my company, we started getting all tangled up with loads of signals
> and
> > slots for many components. We also have a habit of renaming things as
> time
> > goes by, and that can also pose a bit of a problem when dealing with
> > signals & slots, meta object based invocations, etc.
> >
> > So, since our compiler supports the relevant features of C++11, I've made
> > this class, called Dispatcher, which allowed us to develop multi-threaded
> > apps much more easily. Instead of defining many signals and slots, you
> > simply make your component extend QObject, and then, since you can use it
> > with Qt's multi-threading framework, you can use it with the dispatcher.
> >
> > Here's the link to my repository on GitHub. It also gives a small usage
> > example.
> >
> > https://github.com/ymarcov/qtdispatcher
> >
> > Note that I've striven to make it as correct as possible. E.g. if the
> > return value is a reference, then you really get that reference, not a
> copy
> > of it, and same with pointers. Or if it's by value, and the returned
> object
> > has a move constructor, then it will be used. Stuff like that. It's been
> > working very well for quite some time now in my workplace, and used in
> > quite critical areas of the code with much success.
> >
> > Please let me know if you think this could help the Qt project as a
> > built-in class.
> >
> > With best wishes,
> > Yam Marcovic
>
> Hi,
>
> I think if this feature would be added to QtCore, it should be by extending
> QMetaObject::invoke to work with functors.
> By using Qt::BlockingQueuedConnection that would be very similar to what
> you
> have done.
>
> Regards,
> --
> Olivier
>
> Woboq - Qt services and support - http://woboq.com - http://code.woboq.org
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140925/c0af60e3/attachment.html>
More information about the Development
mailing list