summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2001-07-03 15:33:48 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2001-07-03 15:33:48 +0000
commit32364db4695aca003a7aa2ca41a72afe0c0796d3 (patch)
tree4c6a5117fcd79fd58f1d7b090f01830af6362a6c
parent5ef70d1ee4231e626ce1c06f4c5b48b24230260e (diff)
downloadATCD-32364db4695aca003a7aa2ca41a72afe0c0796d3.tar.gz
ChangeLogTag:Tue Jul 3 06:20:13 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
-rw-r--r--ChangeLog34
-rw-r--r--ChangeLogs/ChangeLog-02a34
-rw-r--r--ChangeLogs/ChangeLog-03a34
-rw-r--r--ace/Reactor.h3
-rw-r--r--ace/Reactor.i5
-rw-r--r--ace/Reactor_Impl.h6
-rw-r--r--ace/Refcounted_Auto_Ptr.h2
-rw-r--r--ace/Select_Reactor_Base.cpp47
-rw-r--r--ace/Select_Reactor_Base.h6
-rw-r--r--ace/Select_Reactor_Base.i5
-rw-r--r--ace/Select_Reactor_T.cpp4
-rw-r--r--ace/Timer_Queue_T.h7
-rw-r--r--ace/WFMO_Reactor.cpp41
-rw-r--r--ace/WFMO_Reactor.h6
-rw-r--r--ace/WIN32_Asynch_IO.cpp1
-rw-r--r--ace/WIN32_Asynch_IO.h4
-rw-r--r--tests/Reactor_Notify_Test.cpp38
17 files changed, 220 insertions, 57 deletions
diff --git a/ChangeLog b/ChangeLog
index 6d2a1ae337e..9edecc12ffd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+Tue Jul 3 06:20:13 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
+
+ * ace/Reactor.h,
+ * ace/Reactor_Impl.h,
+ * ace/Select_Reactor_Base.cpp,
+ * ace/Select_Reactor_Base.i,
+ * ace/Select_Reactor_Base.h,
+ * ace/WFMO_Reactor.cpp,
+ * ace/WFMO_Reactor.h: Added an enhancement that allows the
+ Reactor to selectively purge event handlers from its
+ notification queue according to their Reactor_Mask type. Thanks
+ to Edan Ayal <edana@bandwiz.com> for contributing this.
+
+ * tests/Reactor_Notify_Test.cpp (run_notify_purge_test):
+ Added a new set of tests for the new selective notification
+ purging features of the Reactor. Thanks to Edan Ayal
+ <edana@bandwiz.com> for contributing this.
+
+ * ace/WIN32_Asynch_IO.cpp: Removed the
+ ACE_WIN32_Asynch_Result (handler, act, event, 0, 0, priority,
+ signal_number), initializer since we no longer use virtual
+ inheritance. Thanks to Alexander Libman
+ <alexander.libman@baltimore.com> for reporting this.
+
+ * ace/WIN32_Asynch_IO.h: Removed the virtual inheritance from
+ ACE_WIN32_Asynch_Result for the ACE_Asynch_Read_Stream_Result
+ and ACE_Asynch_Read_Dgram_Result classes. Thanks to Alexander
+ Libman <alexander.libman@baltimore.com> for reporting this.
+
+ * ace/Refcounted_Auto_Ptr.h: Made the destructor of
+ ACE_Refcounted_Auto_Ptr virtual so that users can override it
+ locally. Thanks to Jenny Kowald <jkowald@oz.agile.tv> for
+ reporting this.
+
Tue Jul 3 09:40:59 2001 Chad Elliott <elliott_c@ociweb.com>
* include/makeinclude/platform_osf1_4.0.GNU:
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 6d2a1ae337e..9edecc12ffd 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,37 @@
+Tue Jul 3 06:20:13 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
+
+ * ace/Reactor.h,
+ * ace/Reactor_Impl.h,
+ * ace/Select_Reactor_Base.cpp,
+ * ace/Select_Reactor_Base.i,
+ * ace/Select_Reactor_Base.h,
+ * ace/WFMO_Reactor.cpp,
+ * ace/WFMO_Reactor.h: Added an enhancement that allows the
+ Reactor to selectively purge event handlers from its
+ notification queue according to their Reactor_Mask type. Thanks
+ to Edan Ayal <edana@bandwiz.com> for contributing this.
+
+ * tests/Reactor_Notify_Test.cpp (run_notify_purge_test):
+ Added a new set of tests for the new selective notification
+ purging features of the Reactor. Thanks to Edan Ayal
+ <edana@bandwiz.com> for contributing this.
+
+ * ace/WIN32_Asynch_IO.cpp: Removed the
+ ACE_WIN32_Asynch_Result (handler, act, event, 0, 0, priority,
+ signal_number), initializer since we no longer use virtual
+ inheritance. Thanks to Alexander Libman
+ <alexander.libman@baltimore.com> for reporting this.
+
+ * ace/WIN32_Asynch_IO.h: Removed the virtual inheritance from
+ ACE_WIN32_Asynch_Result for the ACE_Asynch_Read_Stream_Result
+ and ACE_Asynch_Read_Dgram_Result classes. Thanks to Alexander
+ Libman <alexander.libman@baltimore.com> for reporting this.
+
+ * ace/Refcounted_Auto_Ptr.h: Made the destructor of
+ ACE_Refcounted_Auto_Ptr virtual so that users can override it
+ locally. Thanks to Jenny Kowald <jkowald@oz.agile.tv> for
+ reporting this.
+
Tue Jul 3 09:40:59 2001 Chad Elliott <elliott_c@ociweb.com>
* include/makeinclude/platform_osf1_4.0.GNU:
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 6d2a1ae337e..9edecc12ffd 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,37 @@
+Tue Jul 3 06:20:13 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
+
+ * ace/Reactor.h,
+ * ace/Reactor_Impl.h,
+ * ace/Select_Reactor_Base.cpp,
+ * ace/Select_Reactor_Base.i,
+ * ace/Select_Reactor_Base.h,
+ * ace/WFMO_Reactor.cpp,
+ * ace/WFMO_Reactor.h: Added an enhancement that allows the
+ Reactor to selectively purge event handlers from its
+ notification queue according to their Reactor_Mask type. Thanks
+ to Edan Ayal <edana@bandwiz.com> for contributing this.
+
+ * tests/Reactor_Notify_Test.cpp (run_notify_purge_test):
+ Added a new set of tests for the new selective notification
+ purging features of the Reactor. Thanks to Edan Ayal
+ <edana@bandwiz.com> for contributing this.
+
+ * ace/WIN32_Asynch_IO.cpp: Removed the
+ ACE_WIN32_Asynch_Result (handler, act, event, 0, 0, priority,
+ signal_number), initializer since we no longer use virtual
+ inheritance. Thanks to Alexander Libman
+ <alexander.libman@baltimore.com> for reporting this.
+
+ * ace/WIN32_Asynch_IO.h: Removed the virtual inheritance from
+ ACE_WIN32_Asynch_Result for the ACE_Asynch_Read_Stream_Result
+ and ACE_Asynch_Read_Dgram_Result classes. Thanks to Alexander
+ Libman <alexander.libman@baltimore.com> for reporting this.
+
+ * ace/Refcounted_Auto_Ptr.h: Made the destructor of
+ ACE_Refcounted_Auto_Ptr virtual so that users can override it
+ locally. Thanks to Jenny Kowald <jkowald@oz.agile.tv> for
+ reporting this.
+
Tue Jul 3 09:40:59 2001 Chad Elliott <elliott_c@ociweb.com>
* include/makeinclude/platform_osf1_4.0.GNU:
diff --git a/ace/Reactor.h b/ace/Reactor.h
index 038f5eef7bb..75a08edfdc7 100644
--- a/ace/Reactor.h
+++ b/ace/Reactor.h
@@ -532,7 +532,8 @@ public:
* the reactor itself). Returns the number of notifications purged.
* Returns -1 on error.
*/
- virtual int purge_pending_notifications (ACE_Event_Handler *);
+ virtual int purge_pending_notifications (ACE_Event_Handler *,
+ ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
// = Assorted helper methods.
diff --git a/ace/Reactor.i b/ace/Reactor.i
index eb392a78df2..6dc267d046a 100644
--- a/ace/Reactor.i
+++ b/ace/Reactor.i
@@ -524,9 +524,10 @@ ACE_Reactor::max_notify_iterations (void)
}
ACE_INLINE int
-ACE_Reactor::purge_pending_notifications (ACE_Event_Handler *eh)
+ACE_Reactor::purge_pending_notifications (ACE_Event_Handler *eh,
+ ACE_Reactor_Mask mask)
{
- return this->implementation ()->purge_pending_notifications (eh);
+ return this->implementation ()->purge_pending_notifications (eh, mask);
}
ACE_INLINE int
diff --git a/ace/Reactor_Impl.h b/ace/Reactor_Impl.h
index b6a15d753d1..5721d1f14c3 100644
--- a/ace/Reactor_Impl.h
+++ b/ace/Reactor_Impl.h
@@ -93,7 +93,8 @@ public:
* <ACE_Event_Handler> object. Returns the number of notifications
* purged. Returns -1 on error.
*/
- virtual int purge_pending_notifications (ACE_Event_Handler * = 0) = 0;
+ virtual int purge_pending_notifications (ACE_Event_Handler * = 0,
+ ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) = 0;
/// Dump the state of an object.
virtual void dump (void) const = 0;
@@ -449,7 +450,8 @@ public:
* <ACE_Event_Handler> object. Returns the number of notifications
* purged. Returns -1 on error.
*/
- virtual int purge_pending_notifications (ACE_Event_Handler * = 0) = 0;
+ virtual int purge_pending_notifications (ACE_Event_Handler * = 0,
+ ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) = 0;
/**
* Check to see if <handle> is associated with a valid Event_Handler
diff --git a/ace/Refcounted_Auto_Ptr.h b/ace/Refcounted_Auto_Ptr.h
index f1207185f25..0e95f360f1e 100644
--- a/ace/Refcounted_Auto_Ptr.h
+++ b/ace/Refcounted_Auto_Ptr.h
@@ -52,7 +52,7 @@ public:
ACE_Refcounted_Auto_Ptr (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r);
/// Destructor.
- ~ACE_Refcounted_Auto_Ptr (void);
+ virtual ~ACE_Refcounted_Auto_Ptr (void);
/// Assignment operator that binds <this> and <r> to the same
/// <ACE_Refcounted_Auto_Ptr_Rep>. An <ACE_Refcounted_Auto_Ptr_Rep>
diff --git a/ace/Select_Reactor_Base.cpp b/ace/Select_Reactor_Base.cpp
index c398a82c620..d4291a0d280 100644
--- a/ace/Select_Reactor_Base.cpp
+++ b/ace/Select_Reactor_Base.cpp
@@ -479,7 +479,8 @@ ACE_Select_Reactor_Notify::max_notify_iterations (void)
// Returns the number of entries removed. Returns -1 on error.
// ACE_NOTSUP_RETURN if ACE_HAS_REACTOR_NOTIFICATION_QUEUE is not defined.
int
-ACE_Select_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh)
+ACE_Select_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh,
+ ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Select_Reactor_Notify::purge_pending_notifications");
@@ -505,26 +506,34 @@ ACE_Select_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh)
-1);
// If this is not a Reactor notify (it is for a particular handler),
- // and it matches the specified handler (or purging all), then
+ // and it matches the specified handler (or purging all),
+ // and applying the mask would totally eliminate the notification, then
// release it and count the number purged.
- if (0 != temp->eh_ && (0 == eh || eh == temp->eh_))
- {
- if (-1 == this->free_queue_.enqueue_head (temp))
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT ("%p\n"),
- ACE_LIB_TEXT ("enqueue_head")),
- -1);
- ++number_purged;
- }
+ if ((0 != temp->eh_) &&
+ (0 == eh || eh == temp->eh_) &&
+ ACE_BIT_DISABLED (temp->mask_, ~mask)) // the existing notificationmask
+ // is left with nothing when
+ // applying the mask
+ {
+ if (-1 == this->free_queue_.enqueue_head (temp))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%p\n"),
+ ACE_LIB_TEXT ("enqueue_head")),
+ -1);
+ ++number_purged;
+ }
else
- {
- // To preserve it, move it to the local_queue.
- if (-1 == local_queue.enqueue_head (temp))
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT ("%p\n"),
- ACE_LIB_TEXT ("enqueue_head")),
- -1);
- }
+ {
+ // To preserve it, move it to the local_queue.
+ // But first, if this is not a Reactor notify (it is for a particularhandler),
+ // and it matches the specified handler (or purging all), then
+ // apply the mask
+ if ((0 != temp->eh_) &&
+ (0 == eh || eh == temp->eh_))
+ ACE_CLR_BITS(temp->mask_, mask);
+ if (-1 == local_queue.enqueue_head (temp))
+ return -1;
+ }
}
if (this->notify_queue_.size ())
diff --git a/ace/Select_Reactor_Base.h b/ace/Select_Reactor_Base.h
index 2ec0874db1e..071de0c6278 100644
--- a/ace/Select_Reactor_Base.h
+++ b/ace/Select_Reactor_Base.h
@@ -176,7 +176,8 @@ public:
* the reactor itself). Returns the number of notifications purged.
* Returns -1 on error.
*/
- virtual int purge_pending_notifications (ACE_Event_Handler *);
+ virtual int purge_pending_notifications (ACE_Event_Handler *,
+ ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
/// Dump the state of an object.
virtual void dump (void) const;
@@ -400,7 +401,8 @@ public:
* <ACE_Event_Handler> object. Returns the number of notifications
* purged. Returns -1 on error.
*/
- virtual int purge_pending_notifications (ACE_Event_Handler * = 0);
+ virtual int purge_pending_notifications (ACE_Event_Handler * = 0,
+ ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
protected:
/// Allow manipulation of the <wait_set_> mask and <ready_set_> mask.
diff --git a/ace/Select_Reactor_Base.i b/ace/Select_Reactor_Base.i
index 0f2e26a04c4..fbeb8d1d75e 100644
--- a/ace/Select_Reactor_Base.i
+++ b/ace/Select_Reactor_Base.i
@@ -71,9 +71,10 @@ ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl ()
}
ACE_INLINE int
-ACE_Select_Reactor_Impl::purge_pending_notifications (ACE_Event_Handler *eh)
+ACE_Select_Reactor_Impl::purge_pending_notifications (ACE_Event_Handler *eh,
+ ACE_Reactor_Mask mask)
{
- return this->notify_handler_->purge_pending_notifications (eh);
+ return this->notify_handler_->purge_pending_notifications (eh, mask);
}
ACE_INLINE int
diff --git a/ace/Select_Reactor_T.cpp b/ace/Select_Reactor_T.cpp
index fb6149ebda5..0d5e5a6f318 100644
--- a/ace/Select_Reactor_T.cpp
+++ b/ace/Select_Reactor_T.cpp
@@ -744,9 +744,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::reset_timer_interval
ACE_TRACE ("ACE_Select_Reactor_T::reset_timer_interval");
ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
- return this->timer_queue_->reset_interval
- (timer_id,
- interval);
+ return this->timer_queue_->reset_interval (timer_id, interval);
}
// Main event loop driver that blocks for <max_wait_time> before
diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h
index 6ffb2ffbab1..574437042b8 100644
--- a/ace/Timer_Queue_T.h
+++ b/ace/Timer_Queue_T.h
@@ -6,13 +6,12 @@
*
* $Id$
*
- * @author Doug Schmidt
- * @author Irfan Pyarali
- * @author and Darrell Brunsch
+ * @author Doug Schmid <schmidt@cs.wustl.edu>
+ * @author Irfan Pyarali <irfan@cs.wustl.edu>
+ * @author and Darrell Brunsch <brunsch@cs.wustl.edu>
*/
//=============================================================================
-
#ifndef ACE_TIMER_QUEUE_T_H
#define ACE_TIMER_QUEUE_T_H
#include "ace/pre.h"
diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp
index a661b7733fa..7039cde14ed 100644
--- a/ace/WFMO_Reactor.cpp
+++ b/ace/WFMO_Reactor.cpp
@@ -2347,7 +2347,8 @@ ACE_WFMO_Reactor_Notify::max_notify_iterations (void)
}
int
-ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh)
+ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh,
+ ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_WFMO_Reactor_Notify::purge_pending_notifications");
@@ -2386,19 +2387,30 @@ ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh)
ACE_reinterpret_cast (ACE_Notification_Buffer *, mb->base ());
// If this is not a Reactor notify (it is for a particular handler),
- // and it matches the specified handler (or purging all), then
+ // and it matches the specified handler (or purging all),
+ // and applying the mask would totally eliminate the notification, then
// release it and count the number purged.
- if (0 != buffer->eh_ && (0 == eh || eh == buffer->eh_))
- {
- mb->release ();
- ++number_purged;
- }
+ if ((0 != buffer->eh_) &&
+ (0 == eh || eh == buffer->eh_) &&
+ ACE_BIT_DISABLED (buffer->mask_, ~mask)) // the existing notification mask
+ // is left with nothing when
+ // applying the mask
+ {
+ mb->release ();
+ ++number_purged;
+ }
else
- {
- // To preserve it, move it to the local_queue.
- if (-1 == local_queue.enqueue_head (mb))
- return -1;
- }
+ {
+ // To preserve it, move it to the local_queue.
+ // But first, if this is not a Reactor notify (it is for a particularhandler),
+ // and it matches the specified handler (or purging all), then
+ // apply the mask
+ if ((0 != buffer->eh_) &&
+ (0 == eh || eh == buffer->eh_))
+ ACE_CLR_BITS(buffer->mask_, mask);
+ if (-1 == local_queue.enqueue_head (mb))
+ return -1;
+ }
}
if (this->message_queue_.message_count ())
@@ -2461,10 +2473,11 @@ ACE_WFMO_Reactor::max_notify_iterations (void)
}
int
-ACE_WFMO_Reactor::purge_pending_notifications (ACE_Event_Handler *eh)
+ACE_WFMO_Reactor::purge_pending_notifications (ACE_Event_Handler *eh,
+ ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_WFMO_Reactor::purge_pending_notifications");
- return this->notify_handler_->purge_pending_notifications (eh);
+ return this->notify_handler_->purge_pending_notifications (eh, mask);
}
// No-op WinSOCK2 methods to help WFMO_Reactor compile
diff --git a/ace/WFMO_Reactor.h b/ace/WFMO_Reactor.h
index d98bdd4612b..4cbc38daef3 100644
--- a/ace/WFMO_Reactor.h
+++ b/ace/WFMO_Reactor.h
@@ -535,7 +535,8 @@ public:
* the reactor itself). Returns the number of notifications purged.
* Returns -1 on error.
*/
- virtual int purge_pending_notifications (ACE_Event_Handler *);
+ virtual int purge_pending_notifications (ACE_Event_Handler *,
+ ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
/// Dump the state of an object.
virtual void dump (void) const;
@@ -1017,7 +1018,8 @@ public:
* <ACE_Event_Handler> object. Returns the number of notifications
* purged. Returns -1 on error.
*/
- virtual int purge_pending_notifications (ACE_Event_Handler * = 0);
+ virtual int purge_pending_notifications (ACE_Event_Handler * = 0,
+ ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
// = Assorted helper methods.
diff --git a/ace/WIN32_Asynch_IO.cpp b/ace/WIN32_Asynch_IO.cpp
index 3abfa651d21..0a9351f3cea 100644
--- a/ace/WIN32_Asynch_IO.cpp
+++ b/ace/WIN32_Asynch_IO.cpp
@@ -675,7 +675,6 @@ ACE_WIN32_Asynch_Read_File_Result::ACE_WIN32_Asynch_Read_File_Result (ACE_Handle
: ACE_Asynch_Result_Impl (),
ACE_Asynch_Read_Stream_Result_Impl (),
ACE_Asynch_Read_File_Result_Impl (),
- ACE_WIN32_Asynch_Result (handler, act, event, 0, 0, priority, signal_number),
ACE_WIN32_Asynch_Read_Stream_Result (handler,
handle,
message_block,
diff --git a/ace/WIN32_Asynch_IO.h b/ace/WIN32_Asynch_IO.h
index 4dc23e4424e..3b3e247c583 100644
--- a/ace/WIN32_Asynch_IO.h
+++ b/ace/WIN32_Asynch_IO.h
@@ -192,7 +192,7 @@ protected:
* ACE_Asynch_Read_Stream::Result class.
*/
class ACE_Export ACE_WIN32_Asynch_Read_Stream_Result : public virtual ACE_Asynch_Read_Stream_Result_Impl,
- public virtual ACE_WIN32_Asynch_Result
+ public ACE_WIN32_Asynch_Result
{
/// Factory class will have special permissions.
friend class ACE_WIN32_Asynch_Read_Stream;
@@ -1249,7 +1249,7 @@ public:
* ACE_Asynch_Read_Dgram::Result class.
*/
class ACE_Export ACE_WIN32_Asynch_Read_Dgram_Result : public virtual ACE_Asynch_Read_Dgram_Result_Impl,
- public virtual ACE_WIN32_Asynch_Result
+ public ACE_WIN32_Asynch_Result
{
/// Factory class will have special permissions.
friend class ACE_WIN32_Asynch_Read_Dgram;
diff --git a/tests/Reactor_Notify_Test.cpp b/tests/Reactor_Notify_Test.cpp
index 2b56d91bb6e..a3ce3f079e2 100644
--- a/tests/Reactor_Notify_Test.cpp
+++ b/tests/Reactor_Notify_Test.cpp
@@ -380,8 +380,9 @@ run_notify_purge_test (void)
ACE_NEW_RETURN (n2, Purged_Notify, -1);
auto_ptr<Purged_Notify> ap (n2);
- r->notify (&n1);
- r->notify (n2);
+ // First test:
+ // Notify EXCEPT, and purge ALL
+ r->notify (&n1); // the mask is EXCEPT_MASK
status = r->purge_pending_notifications (&n1);
if (status == -1 && errno == ENOTSUP)
@@ -390,6 +391,39 @@ run_notify_purge_test (void)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Purged %d notifies; expected 1\n"),
status));
+ // Second test:
+ // Notify READ twice, and WRITE once, and purge READ and WRITE - should purge 3 times.
+ r->notify (&n1, ACE_Event_Handler::READ_MASK);
+ r->notify (&n1, ACE_Event_Handler::READ_MASK);
+ r->notify (&n1, ACE_Event_Handler::WRITE_MASK);
+ status = r->purge_pending_notifications
+ (&n1, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK);
+ if (status != 3)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Purged %d notifies; expected 3\n"),
+ status));
+ // Third test:
+ // Notify READ on 2 handlers, and purge READ|WRITE on all handlers. Should purge 2
+ r->notify (&n1, ACE_Event_Handler::READ_MASK);
+ r->notify (n2, ACE_Event_Handler::READ_MASK);
+ status = r->purge_pending_notifications
+ (0, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK);
+ if (status != 2)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Purged %d notifies; expected 2\n"),
+ status));
+ // Forth test:
+ // Notify EXCEPT and WRITE, purge READ. Should not purge
+ r->notify (&n1); // the mask is EXCEPT_MASK
+ r->notify (&n1, ACE_Event_Handler::WRITE_MASK);
+ status = r->purge_pending_notifications
+ (&n1, ACE_Event_Handler::READ_MASK);
+ if (status != 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Purged %d notifies; expected 0\n"),
+ status));
+ // Fifth test:
+ r->notify (n2);
// <ap> destructor should cause n2's notify to be cancelled.
}