]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/threadno.cpp
Changed documentation const convention for non-objects; added some manual files
[wxWidgets.git] / src / gtk / threadno.cpp
CommitLineData
7c351dad
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: thread.cpp
3// Purpose: No thread support
4// Author: Original from Wolfram Gloger/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
17wxMutex::wxMutex(void)
18{
19 m_locked = FALSE;
20}
21
22wxMutex::~wxMutex(void)
23{
24}
25
26MutexError wxMutex::Lock(void)
27{
28 m_locked = TRUE;
29 return NO_ERROR;
30}
31
32MutexError wxMutex::TryLock(void)
33{
34 m_locked = TRUE;
35 return NO_ERROR;
36}
37
38MutexError wxMutex::Unlock(void)
39{
40 m_locked = FALSE;
41 return NO_ERROR;
42}
43
44wxCondition::wxCondition(void)
45{
46}
47
48wxCondition::~wxCondition(void)
49{
50}
51
52void wxCondition::Wait(wxMutex& WXUNUSED(mutex))
53{
54}
55
56bool wxCondition::Wait(wxMutex& WXUNUSED(mutex), unsigned long WXUNUSED(sec),
57 unsigned long WXUNUSED(nsec))
58{
59 return FALSE;
60}
61
62void wxCondition::Signal(void)
63{
64}
65
66void wxCondition::Broadcast(void)
67{
68}
69
70struct wxThreadPrivate {
71 int thread_id;
72 void* exit_status;
73};
74
75ThreadError wxThread::Create(void)
76{
77 p_internal->exit_status = Entry();
78 OnExit();
79 return NO_ERROR;
80}
81
82ThreadError wxThread::Destroy(void)
83{
84 return RUNNING;
85}
86
87void wxThread::DifferDestroy(void)
88{
89}
90
91void wxThread::TestDestroy(void)
92{
93}
94
95void *wxThread::Join()
96{
97 return p_internal->exit_status;
98}
99
100unsigned long wxThread::GetID()
101{
102 return 0;
103}
104
105bool wxThread::IsMain(void)
106{
107 return TRUE;
108}
109
110bool wxThread::IsAlive(void)
111{
112 return FALSE;
113}
114
115void wxThread::SetPriority(int WXUNUSED(prio)) { }
116int wxThread::GetPriority(void) { }
117
118wxMutex wxMainMutex; // controls access to all GUI functions
119
120wxThread::wxThread()
121{
122 p_internal = new wxThreadPrivate();
123}
124
125wxThread::~wxThread()
126{
127 Cancel();
128 Join();
129 delete p_internal;
130}
131
132// The default callback just joins the thread and throws away the result.
133void wxThread::OnExit()
134{
135 Join();
136}
137
138// Global initialization
139static void wxThreadInit(void *WXUNUSED(client))
140{
141 wxMainMutex.Lock();
142}
143
144// Global cleanup
145static void wxThreadExit(void *WXUNUSED(client))
146{
147 wxMainMutex.Unlock();
148}
149
150// Let automatic initialization be performed from wxCommonInit().
151static struct
152wxThreadGlobal {
153 wxThreadGlobal() {
154 wxRegisterModuleFunction(wxThreadInit, wxThreadExit, NULL);
155 }
156} dummy;