]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/threadno.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Solaris thread support
4 // Author: 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"
28 wxLogDebug( "wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked
);
31 wxMutexError
wxMutex::Lock()
34 return wxMUTEX_NO_ERROR
;
37 wxMutexError
wxMutex::TryLock()
42 return wxMUTEX_NO_ERROR
;
45 wxMutexError
wxMutex::Unlock()
48 return wxMUTEX_UNLOCKED
;
50 return wxMUTEX_NO_ERROR
;
53 wxCondition::wxCondition()
57 wxCondition::~wxCondition()
61 void wxCondition::Wait(wxMutex
& WXUNUSED(mutex
))
65 bool wxCondition::Wait(wxMutex
& WXUNUSED(mutex
), unsigned long WXUNUSED(sec
),
66 unsigned long WXUNUSED(nsec
))
71 void wxCondition::Signal()
75 void wxCondition::Broadcast()
79 struct wxThreadInternal
{
84 wxThreadError
wxThread::Create()
86 p_internal
->exit_status
= Entry();
88 return wxTHREAD_NO_ERROR
;
91 wxThreadError
wxThread::Destroy()
93 return wxTHREAD_NOT_RUNNING
;
96 wxThreadError
wxThread::Pause()
98 return wxTHREAD_NOT_RUNNING
;
101 wxThreadError
wxThread::Resume()
103 return wxTHREAD_NOT_RUNNING
;
106 void wxThread::DeferDestroy( bool WXUNUSED(on
) )
110 void wxThread::TestDestroy()
114 void *wxThread::Join()
116 return p_internal
->exit_status
;
119 unsigned long wxThread::GetID() const
124 bool wxThread::IsMain()
129 bool wxThread::IsRunning() const
134 bool wxThread::IsAlive() const
139 void wxThread::SetPriority(int WXUNUSED(prio
)) { }
140 int wxThread::GetPriority() const { return 0; }
142 wxMutex
*wxMainMutex
; // controls access to all GUI functions
146 p_internal
= new wxThreadInternal();
149 wxThread::~wxThread()
156 // The default callback just joins the thread and throws away the result.
157 void wxThread::OnExit()
163 // Automatic initialization
164 class wxThreadModule
: public wxModule
{
165 DECLARE_DYNAMIC_CLASS(wxThreadModule
)
171 bool wxThreadModule::OnInit() {
172 wxMainMutex
= new wxMutex();
177 void wxThreadModule::OnExit()
179 wxMainMutex
->Unlock();
183 IMPLEMENT_DYNAMIC_CLASS(wxThreadModule
, wxModule
)
185 void wxMutexGuiEnter()
189 void wxMutexGuiLeave()