Overview
Features
Download
Documentation
Community
Add-Ons & Services

Documentation problem with Poco::TimedNotificationQueue

Please post support and help requests here.

Documentation problem with Poco::TimedNotificationQueue

Postby aderouineau » 07 Jul 2009, 01:39

Excerpt of the documentation for the function waitDequeueNotification():

This method returns 0 (null) if wakeUpWaitingThreads() has been called by another thread.


However nowhere is wakeUpWaitingThreads() documented. While looking at the code it seems that no such function is actually used.

I thus seek some light from this great community =)
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38

Re: Documentation problem with Poco::TimedNotificationQueue

Postby guenter » 07 Jul 2009, 06:57

Probably copy-paste bug from NotificationQueue?
guenter
 
Posts: 1138
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Documentation problem with Poco::TimedNotificationQueue

Postby aderouineau » 07 Jul 2009, 15:57

Highly doubt it, since in NotificationQueue, the function is wakeUpAll().

Also, it is rather problematic since, unlike NotificationQueue which has this wakeUpAll() function, it is not possible to properly terminate a thread executing TimedNotificationQueue. Right now the only way i found (which is not as proper as a wakeUpAll() function) is to use waitDequeueNotification(long timeout) with a timeout of 2 seconds (not too long for "quick" shutdown and not too short for unnecessary high refresh rate when there's nothing in the queue).

I think it would be rather important to port the wakeUpAll() mechanism from NotificationQueue to TimedNotificationQueue.
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38

Re: Documentation problem with Poco::TimedNotificationQueue

Postby guenter » 07 Jul 2009, 16:12

It's a copy-paste documentation bug, copied from PriorityNotificationBug, where it should be wakeUpAll() instead of wakeUpWaitingThreads().

NotificationQueue::wakeUpAll() alone is not sufficient to reliable terminate a thread working on a NotificationQueue - it should always be combined with a stop flag. The reason is that wakeUpAll() only notifies threads currently in waitDequeueNotification(). If a thread is currently doing something else, it won't get notified.

The recommended way to stop a thread working on a TimedNotificationQueue is to use a special StopNotification. See Poco::Util::Timer for an example.
guenter
 
Posts: 1138
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Documentation problem with Poco::TimedNotificationQueue

Postby aderouineau » 07 Jul 2009, 17:32

Why not do the same as for the other notification queues? A stop notification could be used for the others as well, but a combination of _stop and WakeUpAll() has been implemented.

Plus my TimedNotificationQueue only handles one type of notification and thus does not have to check what kind of notification it is. Adding a notification to stop the thread will require checking the type of notification.

Oh and I don't get the Util::Timer part...
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron