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