]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/threadno.cpp
don't lose the contents of the combobox if it was set to a value not in a list and...
[wxWidgets.git] / src / gtk1 / threadno.cpp
CommitLineData
7c351dad 1/////////////////////////////////////////////////////////////////////////////
02761f6c 2// Name: src/gtk1/threadno.cpp
926c550d
GL
3// Purpose: Solaris thread support
4// Author: Guilhem Lavaux
7c351dad
GL
5// Modified by:
6// Created: 04/22/98
7// RCS-ID: $Id$
8// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998)
65571936 9// Licence: wxWindows licence
7c351dad 10/////////////////////////////////////////////////////////////////////////////
518b5d2f 11
14f355c2
VS
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
e1bf3ad3 15#include "wx/thread.h"
e4db172a
WS
16
17#ifndef WX_PRECOMP
18 #include "wx/wx.h"
19 #include "wx/log.h"
02761f6c 20 #include "wx/module.h"
e4db172a
WS
21#endif
22
ee4f8c2a 23wxMutex::wxMutex()
7c351dad 24{
518b5d2f 25 m_locked = 0;
7c351dad
GL
26}
27
ee4f8c2a 28wxMutex::~wxMutex()
7c351dad 29{
518b5d2f
VZ
30 if (m_locked)
31 wxLogDebug( "wxMutex warning: destroying a locked mutex (%d locks)", m_locked );
7c351dad
GL
32}
33
c0392997 34wxMutexError wxMutex::Lock()
7c351dad 35{
518b5d2f
VZ
36 m_locked++;
37 return wxMUTEX_NO_ERROR;
7c351dad
GL
38}
39
c0392997 40wxMutexError wxMutex::TryLock()
7c351dad 41{
518b5d2f
VZ
42 if (m_locked > 0)
43 return wxMUTEX_BUSY;
44 m_locked++;
45 return wxMUTEX_NO_ERROR;
7c351dad
GL
46}
47
c0392997 48wxMutexError wxMutex::Unlock()
7c351dad 49{
518b5d2f
VZ
50 if (m_locked == 0)
51 return wxMUTEX_UNLOCKED;
52 m_locked--;
53 return wxMUTEX_NO_ERROR;
7c351dad
GL
54}
55
ee4f8c2a 56wxCondition::wxCondition()
7c351dad
GL
57{
58}
59
ee4f8c2a 60wxCondition::~wxCondition()
7c351dad
GL
61{
62}
63
64void wxCondition::Wait(wxMutex& WXUNUSED(mutex))
65{
66}
67
68bool wxCondition::Wait(wxMutex& WXUNUSED(mutex), unsigned long WXUNUSED(sec),
518b5d2f 69 unsigned long WXUNUSED(nsec))
7c351dad 70{
02761f6c 71 return false;
7c351dad
GL
72}
73
ee4f8c2a 74void wxCondition::Signal()
7c351dad
GL
75{
76}
77
ee4f8c2a 78void wxCondition::Broadcast()
7c351dad
GL
79{
80}
81
518b5d2f
VZ
82struct wxThreadInternal
83{
84 int thread_id;
85 void* exit_status;
7c351dad
GL
86};
87
c0392997 88wxThreadError wxThread::Create()
7c351dad 89{
518b5d2f
VZ
90 p_internal->exit_status = Entry();
91 OnExit();
92 return wxTHREAD_NO_ERROR;
7c351dad
GL
93}
94
c0392997 95wxThreadError wxThread::Destroy()
7c351dad 96{
518b5d2f 97 return wxTHREAD_NOT_RUNNING;
c2dd8380
GL
98}
99
100wxThreadError wxThread::Pause()
101{
518b5d2f 102 return wxTHREAD_NOT_RUNNING;
c2dd8380
GL
103}
104
105wxThreadError wxThread::Resume()
106{
518b5d2f 107 return wxTHREAD_NOT_RUNNING;
7c351dad
GL
108}
109
c0392997 110void wxThread::DeferDestroy( bool WXUNUSED(on) )
7c351dad
GL
111{
112}
113
ee4f8c2a 114void wxThread::TestDestroy()
7c351dad
GL
115{
116}
117
118void *wxThread::Join()
119{
518b5d2f 120 return p_internal->exit_status;
7c351dad
GL
121}
122
ee4f8c2a 123unsigned long wxThread::GetID() const
7c351dad 124{
518b5d2f 125 return 0;
7c351dad
GL
126}
127
ee4f8c2a 128bool wxThread::IsMain()
7c351dad 129{
02761f6c 130 return true;
7c351dad
GL
131}
132
c2dd8380
GL
133bool wxThread::IsRunning() const
134{
02761f6c 135 return false;
c2dd8380
GL
136}
137
ee4f8c2a 138bool wxThread::IsAlive() const
7c351dad 139{
02761f6c 140 return false;
7c351dad
GL
141}
142
143void wxThread::SetPriority(int WXUNUSED(prio)) { }
c0392997 144int wxThread::GetPriority() const { return 0; }
7c351dad 145
6773ae19 146wxMutex *wxMainMutex; // controls access to all GUI functions
7c351dad
GL
147
148wxThread::wxThread()
149{
518b5d2f 150 p_internal = new wxThreadInternal();
7c351dad
GL
151}
152
153wxThread::~wxThread()
154{
518b5d2f
VZ
155 Destroy();
156 Join();
157 delete p_internal;
7c351dad
GL
158}
159
160// The default callback just joins the thread and throws away the result.
161void wxThread::OnExit()
162{
518b5d2f 163 Join();
7c351dad
GL
164}
165
d524867f 166IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
b89156b5 167
518b5d2f 168bool wxThreadModule::OnInit()
d524867f 169{
518b5d2f
VZ
170 wxMainMutex = new wxMutex();
171 wxMainMutex->Lock();
02761f6c 172 return true;
7c351dad
GL
173}
174
c0392997 175void wxThreadModule::OnExit()
7c351dad 176{
518b5d2f
VZ
177 wxMainMutex->Unlock();
178 delete wxMainMutex;
7c351dad
GL
179}
180
d524867f 181
c5f885c0
VZ
182
183void wxMutexGuiEnter()
184{
185}
186
187void wxMutexGuiLeave()
188{
189}