]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/gtk1/threadno.cpp
Use gdk_window_invalidate instead of gtk_widget_queue_draw as the latter doesn't...
[wxWidgets.git] / src / gtk1 / threadno.cpp
... / ...
CommitLineData
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
23wxMutex::wxMutex()
24{
25 m_locked = 0;
26}
27
28wxMutex::~wxMutex()
29{
30 if (m_locked)
31 wxLogDebug( "wxMutex warning: destroying a locked mutex (%d locks)", m_locked );
32}
33
34wxMutexError wxMutex::Lock()
35{
36 m_locked++;
37 return wxMUTEX_NO_ERROR;
38}
39
40wxMutexError wxMutex::TryLock()
41{
42 if (m_locked > 0)
43 return wxMUTEX_BUSY;
44 m_locked++;
45 return wxMUTEX_NO_ERROR;
46}
47
48wxMutexError wxMutex::Unlock()
49{
50 if (m_locked == 0)
51 return wxMUTEX_UNLOCKED;
52 m_locked--;
53 return wxMUTEX_NO_ERROR;
54}
55
56wxCondition::wxCondition()
57{
58}
59
60wxCondition::~wxCondition()
61{
62}
63
64void wxCondition::Wait(wxMutex& WXUNUSED(mutex))
65{
66}
67
68bool wxCondition::Wait(wxMutex& WXUNUSED(mutex), unsigned long WXUNUSED(sec),
69 unsigned long WXUNUSED(nsec))
70{
71 return false;
72}
73
74void wxCondition::Signal()
75{
76}
77
78void wxCondition::Broadcast()
79{
80}
81
82struct wxThreadInternal
83{
84 int thread_id;
85 void* exit_status;
86};
87
88wxThreadError wxThread::Create()
89{
90 p_internal->exit_status = Entry();
91 OnExit();
92 return wxTHREAD_NO_ERROR;
93}
94
95wxThreadError wxThread::Destroy()
96{
97 return wxTHREAD_NOT_RUNNING;
98}
99
100wxThreadError wxThread::Pause()
101{
102 return wxTHREAD_NOT_RUNNING;
103}
104
105wxThreadError wxThread::Resume()
106{
107 return wxTHREAD_NOT_RUNNING;
108}
109
110void wxThread::DeferDestroy( bool WXUNUSED(on) )
111{
112}
113
114void wxThread::TestDestroy()
115{
116}
117
118void *wxThread::Join()
119{
120 return p_internal->exit_status;
121}
122
123unsigned long wxThread::GetID() const
124{
125 return 0;
126}
127
128bool wxThread::IsMain()
129{
130 return true;
131}
132
133bool wxThread::IsRunning() const
134{
135 return false;
136}
137
138bool wxThread::IsAlive() const
139{
140 return false;
141}
142
143void wxThread::SetPriority(int WXUNUSED(prio)) { }
144int wxThread::GetPriority() const { return 0; }
145
146wxMutex *wxMainMutex; // controls access to all GUI functions
147
148wxThread::wxThread()
149{
150 p_internal = new wxThreadInternal();
151}
152
153wxThread::~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.
161void wxThread::OnExit()
162{
163 Join();
164}
165
166IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
167
168bool wxThreadModule::OnInit()
169{
170 wxMainMutex = new wxMutex();
171 wxMainMutex->Lock();
172 return true;
173}
174
175void wxThreadModule::OnExit()
176{
177 wxMainMutex->Unlock();
178 delete wxMainMutex;
179}
180
181
182
183void wxMutexGuiEnter()
184{
185}
186
187void wxMutexGuiLeave()
188{
189}