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

Go to the SVN repository for this file.

1 #ifndef NETSCHEDULE_QUEUE_CLEAN_THREAD__HPP
2 #define NETSCHEDULE_QUEUE_CLEAN_THREAD__HPP
3 
4 /* $Id: queue_clean_thread.hpp 67348 2015-05-11 14:50:34Z sadyrovr $
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: Anatoliy Kuznetsov, Victor Joukov
30  *
31  * File Description: Queue cleaning threads.
32  *
33  *
34  */
35 
36 #include "background_host.hpp"
37 #include <util/thread_nonstop.hpp>
38 
39 
41 
42 class CQueueDataBase;
43 
44 
45 // Purge support
46 // Used as argument and as return value of the method which checks jobs
47 // expiration. See the comments to individual members.
49 {
50  unsigned int scans; // in: max # of scans to be done
51  // out: # of scans done
52  unsigned int deleted; // in: max # of jobs to mark for deletion
53  // out: # of jobs marks for deletion
54  unsigned int job_id; // in: job id to start scan from
55  // out: last scanned job id
56 
58  scans(0), deleted(0), job_id(0)
59  {}
60 };
61 
62 
63 
64 // Thread class, removes obsolete job records
66 {
67 public:
69  CQueueDataBase & qdb,
70  unsigned int sec_delay,
71  unsigned int nanosec_delay,
72  const bool & logging);
74 
75  void RequestStop(void);
76 
77 protected:
78  virtual void * Main(void);
79 
80 private:
81  void x_DoJob(void);
82 
83 private:
86  const bool & m_CleaningLogging;
87  unsigned int m_SecDelay;
88  unsigned int m_NanosecDelay;
89 
90 private:
93 
94 private:
97 };
98 
99 
100 // Thread class, watches job execution, reschedules forgotten jobs
102 {
103 public:
105  CQueueDataBase & qdb,
106  unsigned int sec_delay,
107  unsigned int nanosec_delay,
108  const bool & logging);
110 
111  void RequestStop(void);
112 
113 protected:
114  virtual void * Main(void);
115 
116 private:
117  void x_DoJob(void);
118 
119 private:
122  const bool & m_ExecutionLogging;
123  unsigned int m_SecDelay;
124  unsigned int m_NanosecDelay;
125 
126 private:
129 
130 private:
134 };
135 
136 
137 
139 
140 #endif /* NETSCHEDULE_QUEUE_CLEAN_THREAD__HPP */
141 
CAtomicCounter_WithAutoInit –.
Definition: ncbicntr.hpp:120
CJobQueueCleanerThread(CBackgroundHost &host, CQueueDataBase &qdb, unsigned int sec_delay, unsigned int nanosec_delay, const bool &logging)
CJobQueueCleanerThread & operator=(const CJobQueueCleanerThread &)
virtual void * Main(void)
Derived (user-created) class must provide a real thread function.
CAtomicCounter_WithAutoInit m_StopFlag
CJobQueueCleanerThread(const CJobQueueCleanerThread &)
CAtomicCounter_WithAutoInit m_StopFlag
CJobQueueExecutionWatcherThread & operator=(const CJobQueueExecutionWatcherThread &)
CJobQueueExecutionWatcherThread(CBackgroundHost &host, CQueueDataBase &qdb, unsigned int sec_delay, unsigned int nanosec_delay, const bool &logging)
virtual void * Main(void)
Derived (user-created) class must provide a real thread function.
CJobQueueExecutionWatcherThread(const CJobQueueExecutionWatcherThread &)
CSemaphore –.
Definition: ncbimtx.hpp:1375
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Modified on Wed Apr 17 13:09:50 2024 by modify_doxy.py rev. 669887