1

I currently have a program which use busy pooling and a bunch of thread to monitor states of object, process data, and pass data.. This is all very hard to manage/waste cpu time. I am looking at removing thread and using signal / slot as there is none of my code which "block".

So I will signal states of my object, which is easy. What's harder is I also want to use slots to signals Data, and pass the data.

Basically: A->SignalIHAVEDATA(B.slot() and C.slot()) B and C might not be able to process the data. So should I keep a flag in B and C telling them they is data. Or should I just Re-signal every X ms until the data has been taken.

Also..

Lets say B accept the data. Would it make sense that Inside the B.Slot, it take handleToA->getData(); && process the data? && signalAnotherThing.

If I emit signalA and within slotA I emit a signalB would the slotB be processed before slotA return? (If this chain is very long it might take a while before slotA return?)

Thanks for helping:)

JP.
  • 495
  • 1
  • 9
  • 20

1 Answers1

4

The best signal & slot library is of course Boost.Signal2. It's portable, thread-safe, template-based and header only. You'll love it.

And yes. I know you asked this one year ago, but I simply couldn't left it unanswered.

fouronnes
  • 3,838
  • 23
  • 41