1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: No thread support
4 // Author: Original from Wolfram Gloger/Guilhem Lavaux
8 // Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "thread.h"
16 #include "wx/thread.h"
26 wxDebugMsg("wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked
);
29 MutexError wxMutex
::Lock()
32 return MUTEX_NO_ERROR
;
35 MutexError wxMutex
::TryLock()
40 return MUTEX_NO_ERROR
;
43 MutexError wxMutex
::Unlock()
46 return MUTEX_UNLOCKED
;
48 return MUTEX_NO_ERROR
;
51 wxCondition
::wxCondition()
55 wxCondition
::~wxCondition()
59 void wxCondition
::Wait(wxMutex
& WXUNUSED(mutex
))
63 bool wxCondition
::Wait(wxMutex
& WXUNUSED(mutex
), unsigned long WXUNUSED(sec
),
64 unsigned long WXUNUSED(nsec
))
69 void wxCondition
::Signal()
73 void wxCondition
::Broadcast()
77 struct wxThreadPrivate
{
82 ThreadError wxThread
::Create()
84 p_internal
->exit_status
= Entry();
86 return THREAD_NO_ERROR
;
89 ThreadError wxThread
::Destroy()
91 return THREAD_RUNNING
;
94 void wxThread
::DeferDestroy()
98 void wxThread
::TestDestroy()
102 void *wxThread
::Join()
104 return p_internal
->exit_status
;
107 unsigned long wxThread
::GetID() const
112 bool wxThread
::IsMain()
117 bool wxThread
::IsAlive() const
122 void wxThread
::SetPriority(int WXUNUSED(prio
)) { }
123 int wxThread
::GetPriority() const { }
125 wxMutex wxMainMutex
; // controls access to all GUI functions
129 p_internal
= new wxThreadPrivate();
132 wxThread
::~wxThread()
139 // The default callback just joins the thread and throws away the result.
140 void wxThread
::OnExit()
146 // Automatic initialization
147 class wxThreadModule
: public wxModule
{
148 DECLARE_DYNAMIC_CLASS(wxThreadModule
)
154 bool wxThreadModule
::OnInit() {
159 void wxThreadModule
::wxThreadExit()
161 wxMainMutex
.Unlock();
164 IMPLEMENT_DYNAMIC_CLASS(wxThreadModule
, wxModule
)