Menu

[r6913]: / branches / wxsmith_addons / src / include / managedthread.h  Maximize  Restore  History

Download this file

47 lines (39 with data), 1.3 kB

 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
/*
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
* http://www.gnu.org/licenses/lgpl-3.0.html
*/
#ifndef managedthread_h
#define managedthread_h
#include <wx/thread.h>
#include <wx/dynarray.h>
class ManagedThread;
WX_DEFINE_ARRAY(ManagedThread*, ManagedThreadsArray);
class ManagedThread : public wxThread
{
public:
ManagedThread(bool* abortflag = 0L);
virtual ~ManagedThread();
static unsigned long count_running();
static unsigned long count_threads();
static void abort_all(); // Warning! Once set, can't be reset!
static void abort(bool* flag,bool delete_thread = true);
bool* get_abort_location() { if(!this) return 0L;return m_pAbort; }
void set_abort_location(bool* abortflag)
{
if(!this) return;
m_pAbort=abortflag;
}
protected:
virtual bool TestDestroy();
virtual void* DoRun(); // Override it for your own class. Called by Entry()
virtual void* Entry();
bool is_aborted();
static ManagedThread* GetThread(size_t n);
static void DeleteThreadFromList(ManagedThread* thread);
static wxCriticalSection s_count_running_mutex;
static wxCriticalSection s_list_mutex;
static unsigned long s_running;
bool* m_pAbort;
static bool s_abort_all;
};
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.