NCBI C++ ToolKit
wn_cleanup.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef CONNECT_SERVICES__WN_CLEANUP__HPP
2 #define CONNECT_SERVICES__WN_CLEANUP__HPP
3 
4 /* $Id: wn_cleanup.hpp 64070 2014-08-14 21:35:38Z kazimird $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Dmitry Kazimirov
30  *
31  * File Description:
32  * NetSchedule Worker Node - per-job and global clean-up, declarations.
33  */
34 
36 
37 
38 #define NCBI_USE_ERRCODE_X ConnServ_WorkerNode
39 
41 
43 {
44 public:
46 
47  virtual void AddListener(IWorkerNodeCleanupEventListener* listener);
48  virtual void RemoveListener(IWorkerNodeCleanupEventListener* listener);
49 
50  virtual void CallEventHandlers();
51 
52  void RemoveListeners(const TListeners& listeners);
53 
54 protected:
57 };
58 
60 {
61 public:
62  CWorkerNodeJobCleanup(CWorkerNodeCleanup* worker_node_cleanup) :
63  m_WorkerNodeCleanup(worker_node_cleanup)
64  {
65  }
66 
67  virtual void AddListener(IWorkerNodeCleanupEventListener* listener);
68  virtual void RemoveListener(IWorkerNodeCleanupEventListener* listener);
69 
70  virtual void CallEventHandlers();
71 
72 private:
74 };
75 
77 {
78 public:
80  IGridWorkerNodeApp_Listener* listener) :
81  m_WorkerNode(worker_node),
82  m_Listener(listener),
83  m_Semaphore(0, 1)
84  {
85  }
86 
87  bool Wait(unsigned seconds) {return m_Semaphore.TryWait(seconds);}
88 
89 protected:
90  virtual void* Main();
91 
92 private:
96 };
97 
99 
100 #endif // CONNECT_SERVICES__WN_CLEANUP__HPP
CFastMutex –.
Definition: ncbimtx.hpp:667
bool Wait(unsigned seconds)
Definition: wn_cleanup.hpp:87
CGridCleanupThread(SGridWorkerNodeImpl *worker_node, IGridWorkerNodeApp_Listener *listener)
Definition: wn_cleanup.hpp:79
CSemaphore m_Semaphore
Definition: wn_cleanup.hpp:95
SGridWorkerNodeImpl * m_WorkerNode
Definition: wn_cleanup.hpp:93
virtual void * Main()
Derived (user-created) class must provide a real thread function.
Definition: wn_cleanup.cpp:107
IGridWorkerNodeApp_Listener * m_Listener
Definition: wn_cleanup.hpp:94
CSemaphore –.
Definition: ncbimtx.hpp:1375
set< IWorkerNodeCleanupEventListener * > TListeners
Definition: wn_cleanup.hpp:45
TListeners m_Listeners
Definition: wn_cleanup.hpp:55
CFastMutex m_ListenersLock
Definition: wn_cleanup.hpp:56
virtual void CallEventHandlers()
Definition: wn_cleanup.cpp:57
virtual void RemoveListener(IWorkerNodeCleanupEventListener *listener)
Definition: wn_cleanup.cpp:50
void RemoveListeners(const TListeners &listeners)
Definition: wn_cleanup.cpp:75
virtual void AddListener(IWorkerNodeCleanupEventListener *listener)
Definition: wn_cleanup.cpp:44
CWorkerNodeJobCleanup(CWorkerNodeCleanup *worker_node_cleanup)
Definition: wn_cleanup.hpp:62
virtual void AddListener(IWorkerNodeCleanupEventListener *listener)
Definition: wn_cleanup.cpp:84
virtual void CallEventHandlers()
Definition: wn_cleanup.cpp:98
CWorkerNodeCleanup * m_WorkerNodeCleanup
Definition: wn_cleanup.hpp:73
virtual void RemoveListener(IWorkerNodeCleanupEventListener *listener)
Definition: wn_cleanup.cpp:91
Listener of events generated by CGridWorkerNodeApp.
Clean-up event source for the worker node.
Definition: grid_worker.hpp:98
NetSchedule worker node application.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
bool TryWait(unsigned int timeout_sec=0, unsigned int timeout_nsec=0)
Timed wait.
Definition: ncbimtx.cpp:1844
Modified on Mon Apr 22 04:05:19 2024 by modify_doxy.py rev. 669887