Well, it's as single threaded as it can be, and I think that is the problem. 
The emits are direct invocations.  The problem arises when I want to simulate 
the communications - the comms with other systems won't happen the same way as 
if I pretend to get a reply.

For what I am running into, there is a remote system that is being communicated 
with. I can be connected to it, but I can't be connected all the time, so I 
have a look up of request:response. instead of doing the actual i/o I pretend 
to get the response back:
if (dummyMode == InDummyMode) {
        Message m = Message::parse(message);
        QByteArray reply = dummyReplies.contains(m.op) ? dummyReplies[m.op]: "";
        if (reply.length()) {
                qDebug() << Q_FUNC_INFO << "dummy reply" << reply;
                emit received(reply);
        }
}

However in the live system the direct invocation does not occur, this creates 
differences in the signal emission order between the dummy and the real system. 
For whatever reason, the handlers get inverted. I need to find a way to not 
have them switch order. I cant start Function 10 (STF10) before I've passed 
function 9 (PSF09). Passing 9 is what starts 10.


> Sent: Friday, November 01, 2019 at 11:45 AM
> From: "Giuseppe D'Angelo via Interest" <interest@qt-project.org>
> To: interest@qt-project.org
> Subject: Re: [Interest] Help, I'm in QML signal hell
>
> Il 01/11/19 17:42, Jason H ha scritto:
> > I am using signals/slots in QML and the signal emissions are getting 
> > inverted.
> >
> > Here's my example:
> > bool Socket::emitSignalForOp(const QByteArray &) "STF10" 10
> > bool Socket::emitSignalForOp(const QByteArray &) "PSF09" 11
> >
> > STF10 necessarily comes after PSF09. In wall-clock time it does. But Qt is 
> > not getting the order right. The number above is the signal emission 
> > number, so it's not a display issue.
>
> You need to share more about your code.
>
> Just a word of caution: if we're talking about multithreaded code, "wall
> clock time" does simply not exist. Threads are relativistic...
>
> My 2 c,
> --
> Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
> KDAB (France) S.A.S., a KDAB Group company
> Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
> KDAB - The Qt, C++ and OpenGL Experts
>
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to