c++ - Signaling failure in qt slots -


I have a 'constructor' object, which runs through some data and emits different signals, its Based on what data item comes forward, queue.

Each of those signals is processed by a 'consumer object' at a time (other users need to disconnect their slots before engaging manufacturer's signals).

If processing on the consumer side fails for any reason, then the processing of the queue should be stopped because there is no point in moving forward with it.

What would be the optimal way to give to the producer, that there is no further requirement because of any extraordinary situation? Since there is an indicator for the creator of the consumers, I think that there can be many different ways, just that I am not sure they are race-safe (I do not know what I can do in order

  • Set a flag on the manufacturer, which can be checked at the next instance so that it will know that it is time
  • related to consumer (and productive) Slot), enter a signal Processing should be stopped when emitted

I am thinking that these solutions are viable in the following situations:

  • Manufacturers and consumers from the same thread
  • Manufacturer and Consumer (s)

In short, I have to make a complete decision if there is no additional resource if the user reports an error .

As you might guess, I am not very familiar with Qt's idioms for such things.

You have something related to interconnected The questions are there.

The most important question I relate to is the signal / slot working with threading.

When using a signal / slot in a thread, the QT assumes one or "direct" connect by default. In direct connect mode, the signal / slot works like a nearly callback function. This means that the function emits a substrin call essentially by emitting the signal.

When transmitting signals / slots to threads, by default the QT assumes a QiKeyconction by default. Whatever has happened here is complicated. Received signal received by QApplicationCore.

  • The core slot makes a deep copy of the logic in the data space of the received thread.
  • The control is returned to the function which emits the signal
  • Calls the core slot when it can be based on the event queue.
  • So knowing this, knowing the slot function has closed down on your original question processing? There is no phrase in Qt, which I know about how to pass this information back. But the idiom signaling thread with the QT signal / slot should not know anything about how the slot function works or how the connection type is.

    Therefore to process my recommended data will pass the data through an indicator. In the data, I will add two fields -

    1. At least the result flag contains the state for "no start", "complete", "complete w / errors" and "removal of work" You can. The "Abort Function" flag will be set in the catch block of an attempt / catch block.
    2. A watchdog timer field based on the current date / time set when the signal is emitted. If the signaling thread uses this value, then to determine whether the consumption thread has failed completely or not.

    Using this approach - - There is no reason that the calling thread should have any direct knowledge of the signal thread. There is nothing in this framework that you need to change to replace with a threaded or multiple threaded.

    Hope this helps with your problem. This is the way we are currently using in our shop.


    Comments