updated NotificationQueue sample

This commit is contained in:
Guenter Obiltschnig 2009-04-14 11:03:48 +00:00
parent 9cb9229a4e
commit e1cda6be1c

View File

@ -1,7 +1,7 @@
// //
// NotificationQueue.cpp // NotificationQueue.cpp
// //
// $Id: //poco/svn/Foundation/samples/NotificationQueue/src/NotificationQueue.cpp#1 $ // $Id: //poco/Main/Foundation/samples/NotificationQueue/src/NotificationQueue.cpp#12 $
// //
// This sample demonstrates the NotificationQueue, ThreadPool, // This sample demonstrates the NotificationQueue, ThreadPool,
// FastMutex and ScopedLock classes. // FastMutex and ScopedLock classes.
@ -58,6 +58,8 @@ class WorkNotification: public Notification
// The notification sent to worker threads. // The notification sent to worker threads.
{ {
public: public:
typedef AutoPtr<WorkNotification> Ptr;
WorkNotification(int data): WorkNotification(int data):
_data(data) _data(data)
{ {
@ -89,10 +91,10 @@ public:
Random rnd; Random rnd;
for (;;) for (;;)
{ {
AutoPtr<Notification> pNf(_queue.waitDequeueNotification()); Notification::Ptr pNf(_queue.waitDequeueNotification());
if (pNf) if (pNf)
{ {
WorkNotification* pWorkNf = dynamic_cast<WorkNotification*>(pNf.get()); WorkNotification::Ptr pWorkNf = pNf.cast<WorkNotification>();
if (pWorkNf) if (pWorkNf)
{ {
{ {