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