File: FinishedSignalThreadManager.h

package info (click to toggle)
passage 4%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 2,692 kB
  • ctags: 2,203
  • sloc: cpp: 18,864; objc: 272; sh: 134; makefile: 120; perl: 67; ansic: 44
file content (82 lines) | stat: -rw-r--r-- 1,502 bytes parent folder | download | duplicates (30)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * Modification History
 *
 * 2004-November-9    Jason Rohrer
 * Created.
 * Modified from MUTE's ChannelReceivingThreadManager.
 *
 * 2005-January-9    Jason Rohrer
 * Changed to sleep on a semaphore to allow sleep to be interrupted.
 */



#ifndef FINISHED_SIGNAL_THREAD_MANAGER_INCLUDED
#define FINISHED_SIGNAL_THREAD_MANAGER_INCLUDED



#include "minorGems/system/FinishedSignalThread.h"

#include "minorGems/util/SimpleVector.h"
#include "minorGems/system/Thread.h"
#include "minorGems/system/MutexLock.h"
#include "minorGems/system/BinarySemaphore.h"



/**
 * A thread that manages the destruction of FinishedSignalThreads.
 *
 * @author Jason Rohrer.
 */
class FinishedSignalThreadManager : public Thread {



    public:
        
        /**
         * Constructs and starts this manager.
         */
        FinishedSignalThreadManager();


        
        /**
         * Stops and destroys this manager.
         */
        ~FinishedSignalThreadManager();

        

        /**
         * Adds a thread to this manager.
         *
         * @param inThread the thread to add.
         *   Will be destroyed by this class.
         */
        void addThread( FinishedSignalThread *inThread );

        

        // implements the Thread interface
        void run();


        
    protected:
        MutexLock *mLock;

        SimpleVector<FinishedSignalThread *> *mThreadVector;
        
        char mStopSignal;

        BinarySemaphore *mSleepSemaphore;
        
    };




#endif