]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/gtk1/threadno.cpp
wxMimeTypesManagerImpl::GetFileTypeFromMimeType() implemented
[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#ifdef __GNUG__
12#pragma implementation "thread.h"
13#endif
14
15#include "wx/wx.h"
16#include "wx/module.h"
17#include "wx/thread.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)\n", 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 int thread_id;
81 void* exit_status;
82};
83
84wxThreadError wxThread::Create()
85{
86 p_internal->exit_status = Entry();
87 OnExit();
88 return wxTHREAD_NO_ERROR;
89}
90
91wxThreadError wxThread::Destroy()
92{
93 return wxTHREAD_NOT_RUNNING;
94}
95
96wxThreadError wxThread::Pause()
97{
98 return wxTHREAD_NOT_RUNNING;
99}
100
101wxThreadError wxThread::Resume()
102{
103 return wxTHREAD_NOT_RUNNING;
104}
105
106void wxThread::DeferDestroy( bool WXUNUSED(on) )
107{
108}
109
110void wxThread::TestDestroy()
111{
112}
113
114void *wxThread::Join()
115{
116 return p_internal->exit_status;
117}
118
119unsigned long wxThread::GetID() const
120{
121 return 0;
122}
123
124bool wxThread::IsMain()
125{
126 return TRUE;
127}
128
129bool wxThread::IsRunning() const
130{
131 return FALSE;
132}
133
134bool wxThread::IsAlive() const
135{
136 return FALSE;
137}
138
139void wxThread::SetPriority(int WXUNUSED(prio)) { }
140int wxThread::GetPriority() const { return 0; }
141
142wxMutex *wxMainMutex; // controls access to all GUI functions
143
144wxThread::wxThread()
145{
146 p_internal = new wxThreadInternal();
147}
148
149wxThread::~wxThread()
150{
151 Destroy();
152 Join();
153 delete p_internal;
154}
155
156// The default callback just joins the thread and throws away the result.
157void wxThread::OnExit()
158{
159 Join();
160}
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}