home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / threads.zip / iasyngui.hpp < prev    next >
Text File  |  1995-11-11  |  5KB  |  104 lines

  1. /* NOSHIP */
  2. #ifndef _IASYNGUI_
  3. #define _IASYNGUI_
  4. /*******************************************************************************
  5. * FILE NAME: iasyngui.hpp
  6. *
  7. * DESCRIPTION:
  8. *   Declaration of the class(es):
  9. *     IAsyncNotifierGUIThread - Class for asynchronous notifier GUI threads.
  10. *
  11. * COPYRIGHT:
  12. *   Licensed Materials - Property of IBM
  13. *   (C) Copyright IBM Corporation 1995
  14. *   All Rights Reserved
  15. *   US Government Users Restricted Rights - Use, duplication, or disclosure
  16. *   restricted by GSA ADP Schedule Contract with IBM Corp.
  17. *
  18. *******************************************************************************/
  19. #ifndef _IASYNTHR_
  20.   #include <iasynthr.hpp>
  21. #endif
  22.  
  23. // Other dependency classes:
  24. #ifndef _IRESLOCK_
  25.   #include <ireslock.hpp>
  26. #endif
  27.  
  28. class INotificationEvent;
  29. class IObjectWindow;
  30. class IAsyncNotificationHandler;
  31.  
  32. // Align classes on four byte boundary.
  33. #pragma pack(4)
  34.  
  35. class IAsyncNotifierGUIThread : public IAsyncNotifierThread {
  36. /*******************************************************************************
  37. *
  38. * This class implements the interface for asynchronous notifier GUI thread
  39. * objects.
  40. *
  41. *******************************************************************************/
  42.  
  43. public:
  44. /*------------------------------ Constructors ----------------------------------
  45. | You can construct an object of this class as follows:                        |
  46. |   - With the default constructor.                                            |
  47. |-----------------------------------------------------------------------------*/
  48. IAsyncNotifierGUIThread ( );
  49.  
  50. virtual ~IAsyncNotifierGUIThread ( );
  51.  
  52. /*--------------------------- Reference Counting -------------------------------
  53. | Used by IAsyncNotifier objects to remove references to this object.          |
  54. |   removeRef - Calls base class implementation.  Then if the count is zero    |
  55. |               the object window is closed.                                   |
  56. |-----------------------------------------------------------------------------*/
  57. virtual unsigned long removeRef ( );
  58.  
  59. /*-------------------------- Enqueue Notification ------------------------------
  60. | Used by IAsyncNotifier objects to enque notifications.                       |
  61. |   enqueueNotification - Places the notification on this thread's queue.      |
  62. |-----------------------------------------------------------------------------*/
  63. virtual IAsyncNotifierGUIThread & enqueueNotification (
  64.                                     const INotificationEvent & anEvent );
  65.  
  66. /*---------------------------- Process Messages --------------------------------
  67. | Use this to start dispatching notifications for this thread.                 |
  68. |   processMsgs - Throws an invalid request exception if the current thread is |
  69. |                 not this thread.  This function does not return until        |
  70. |                 IThread::current()::processMsgs() returns.  This function    |
  71. |                 should be called once by IAsyncNotifier::run and this object |
  72. |                 should be deleted after this function returns.               |
  73. |-----------------------------------------------------------------------------*/
  74. virtual IAsyncNotifierGUIThread & processMsgs ( );
  75.  
  76. /*-------------------------- Delete Notifications ------------------------------
  77. | IAsyncNotifier calls this from its destructor to have all pending            |
  78. | notifications deleted.                                                       |
  79. |   deleteNotificationsFor - Ensures that all notifications for the passed     |
  80. |                            object are never dispatched.  Throws an invalid   |
  81. |                            request exception if the current thread is not    |
  82. |                            this thread.                                      |
  83. |-----------------------------------------------------------------------------*/
  84. virtual IAsyncNotifierGUIThread & deleteNotificationsFor (
  85.                                     const IAsyncNotifier & asyncNotifier );
  86.  
  87.  
  88. private:
  89. // The private copy constructor and assignment operator are not implemented.
  90. IAsyncNotifierGUIThread ( const IAsyncNotifierGUIThread & rhs );
  91. IAsyncNotifierGUIThread & operator = ( const IAsyncNotifierGUIThread & rhs );
  92.  
  93. /*--------------------------- Private State Data -----------------------------*/
  94. IObjectWindow             * objectWindow;
  95. IAsyncNotificationHandler * asyncNotificationHandler;
  96. IPrivateResource            objectWindowKey;
  97.  
  98. }; // IAsyncNotifierGUIThread
  99.  
  100. // Resume compiler default packing.
  101. #pragma pack()
  102.  
  103. #endif // _IASYNGUI_
  104.