mirror of
https://github.com/pocoproject/poco.git
synced 2025-05-03 15:58:23 +02:00
updated NotificationQueue sample
This commit is contained in:
parent
9cb9229a4e
commit
e1cda6be1c
@ -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)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user