~registry/codeblocks/trunk

« back to all changes in this revision

Viewing changes to src/sdk/managedthread.h

  • Committer: mandrav
  • Date: 2007-02-12 14:55:28 UTC
  • Revision ID: svn-v4:98b59c6a-2706-0410-b7d6-d2fa1a1880c9:trunk:3594
* First part of directories layout re-organization: moved all sdk header files to a new dir named "include".

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef managedthread_h
2
 
#define managedthread_h
3
 
 
4
 
#include <wx/thread.h>
5
 
#include <wx/dynarray.h>
6
 
 
7
 
class ManagedThread;
8
 
 
9
 
WX_DEFINE_ARRAY(ManagedThread*, ManagedThreadsArray);
10
 
 
11
 
class ManagedThread : public wxThread
12
 
{
13
 
public:
14
 
    ManagedThread(bool* abortflag  = 0L);
15
 
    virtual ~ManagedThread();
16
 
    static unsigned long count_running();
17
 
    static unsigned long count_threads();
18
 
    static void abort_all(); // Warning! Once set, can't be reset!
19
 
    static void abort(bool* flag,bool delete_thread = true);
20
 
    bool* get_abort_location() { if(!this) return 0L;return m_pAbort; }
21
 
    void set_abort_location(bool* abortflag)
22
 
    {
23
 
        if(!this) return;
24
 
        m_pAbort=abortflag;
25
 
    }
26
 
protected:
27
 
    virtual bool TestDestroy();
28
 
    virtual void* DoRun(); // Override it for your own class. Called by Entry()
29
 
    virtual void* Entry();
30
 
    bool is_aborted();
31
 
    static ManagedThread* GetThread(size_t n);
32
 
    static void DeleteThreadFromList(ManagedThread* thread);
33
 
 
34
 
    static wxCriticalSection s_count_running_mutex;
35
 
    static wxCriticalSection s_list_mutex;
36
 
    static unsigned long s_running;
37
 
    bool* m_pAbort;
38
 
    static bool s_abort_all;
39
 
};
40
 
 
41
 
#endif