]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/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 bool wxThread::IsMain()
128 bool wxThread::IsRunning() const
133 bool wxThread::IsAlive() const
138 void wxThread::SetPriority(int WXUNUSED(prio
)) { }
139 int wxThread::GetPriority() const { return 0; }
141 wxMutex wxMainMutex
; // controls access to all GUI functions
145 p_internal
= new wxThreadInternal();
148 wxThread::~wxThread()
155 // The default callback just joins the thread and throws away the result.
156 void wxThread::OnExit()
162 // Automatic initialization
163 class wxThreadModule
: public wxModule
{
164 DECLARE_DYNAMIC_CLASS(wxThreadModule
)
170 bool wxThreadModule::OnInit() {
175 void wxThreadModule::OnExit()
177 wxMainMutex
.Unlock();
180 IMPLEMENT_DYNAMIC_CLASS(wxThreadModule
, wxModule
)