Add-Ons & Services

Question regarding NotificationQueue thread safety

Please post support and help requests here.

Question regarding NotificationQueue thread safety

Postby throstur62 » 11 Dec 2013, 20:56

I have thread A, B, C and D.
Thread A has to sends urgent Notifications to B, B has to send notifications to C, C sends notifications to D and finally D sends Notificatins to B.

Q1: Can I use the same NotificationQueue for all of those, or do I have to use many NotificationQueues? Please note that both A and D need to enque notifications ot B. And B waits on a quue....so it has to be possible that more than one threads can enque to the same queue for this model.

Q2: If I can use one queue do I need to enter a CriticalSeciton (Poco::FastMutex::ScopedLock) when calling NotificationQueue::enqueueNotification(pNf) and NotificationQueue::enqueueUrgentNotification(pNf)?

Q3: A notification 'pNf' that thread B receives (B waits on the queue with queue.waitDequeueNotification()). Can B modify the data in *pNf and then forward it to C using queue.enqueueNotification(pNf). Or do I have to use copy consturctor (in thread B):
pNewNf = new MyNotification(pNf);
*pNewNf.data = blabla;

Posts: 11
Joined: 22 Nov 2012, 18:44

Return to Support

Who is online

Users browsing this forum: Silvos90 and 1 guest