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