]>
git.saurik.com Git - wxWidgets.git/blob - src/qt/threadno.cpp
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/module.h"
17 #include "wx/thread.h"
27 wxDebugMsg("wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked
);
30 wxMutexError
wxMutex::Lock()
33 return MUTEX_NO_ERROR
;
36 wxMutexError
wxMutex::TryLock()
41 return MUTEX_NO_ERROR
;
44 wxMutexError
wxMutex::Unlock()
47 return MUTEX_UNLOCKED
;
49 return MUTEX_NO_ERROR
;
52 wxCondition::wxCondition()
56 wxCondition::~wxCondition()
60 void wxCondition::Wait(wxMutex
& WXUNUSED(mutex
))
64 bool wxCondition::Wait(wxMutex
& WXUNUSED(mutex
), unsigned long WXUNUSED(sec
),
65 unsigned long WXUNUSED(nsec
))
70 void wxCondition::Signal()
74 void wxCondition::Broadcast()
78 struct wxThreadInternal
{
83 wxThreadError
wxThread::Create()
85 p_internal
->exit_status
= Entry();
87 return THREAD_NO_ERROR
;
90 wxThreadError
wxThread::Destroy()
92 return THREAD_NOT_RUNNING
;
95 wxThreadError
wxThread::Pause()
97 return THREAD_NOT_RUNNING
;
100 wxThreadError
wxThread::Resume()
102 return THREAD_NOT_RUNNING
;
105 void wxThread::DeferDestroy( bool WXUNUSED(on
) )
109 void wxThread::TestDestroy()
113 void *wxThread::Join()
115 return p_internal
->exit_status
;
118 unsigned long wxThread::GetID() const
123 wxThread
*wxThread::GetThreadFromID(unsigned long WXUNUSED(id
)) const
128 bool wxThread::IsMain()
133 bool wxThread::IsRunning() const
138 bool wxThread::IsAlive() const
143 void wxThread::SetPriority(int WXUNUSED(prio
)) { }
144 int wxThread::GetPriority() const { return 0; }
146 wxMutex
*wxMainMutex
; // controls access to all GUI functions
150 p_internal
= new wxThreadInternal();
153 wxThread::~wxThread()
160 // The default callback just joins the thread and throws away the result.
161 void wxThread::OnExit()
167 // Automatic initialization
168 class wxThreadModule
: public wxModule
{
169 DECLARE_DYNAMIC_CLASS(wxThreadModule
)
175 bool wxThreadModule::OnInit() {
176 wxMainMutex
= new wxMutex();
181 void wxThreadModule::OnExit()
183 wxMainMutex
->Unlock();
187 IMPLEMENT_DYNAMIC_CLASS(wxThreadModule
, wxModule
)