]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/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_RUNNING
;
95 void wxThread::DeferDestroy( bool WXUNUSED(on
) )
99 void wxThread::TestDestroy()
103 void *wxThread::Join()
105 return p_internal
->exit_status
;
108 unsigned long wxThread::GetID() const
113 bool wxThread::IsMain()
118 bool wxThread::IsAlive() const
123 void wxThread::SetPriority(int WXUNUSED(prio
)) { }
124 int wxThread::GetPriority() const { return 0; }
126 wxMutex wxMainMutex
; // controls access to all GUI functions
130 p_internal
= new wxThreadInternal();
133 wxThread::~wxThread()
140 // The default callback just joins the thread and throws away the result.
141 void wxThread::OnExit()
147 // Automatic initialization
148 class wxThreadModule
: public wxModule
{
149 DECLARE_DYNAMIC_CLASS(wxThreadModule
)
155 bool wxThreadModule::OnInit() {
160 void wxThreadModule::OnExit()
162 wxMainMutex
.Unlock();
165 IMPLEMENT_DYNAMIC_CLASS(wxThreadModule
, wxModule
)