~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cslib/CSObject.cc

  • Committer: Brian Aker
  • Date: 2010-05-26 21:49:18 UTC
  • mto: This revision was merged to the branch mainline in revision 1568.
  • Revision ID: brian@gaz-20100526214918-8kdibq48e9lnyr6t
This fixes bug 586009, increases the size of the log files so that the UNION
test doesn't hit Innodb's default limit. Increases the size of the initial
Innodb data file, and fixes one case where an empty string on error was
causing a crash on OSX.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2008 PrimeBase Technologies GmbH, Germany
2
 
 *
3
 
 * PrimeBase Media Stream for MySQL
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or
8
 
 * (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
 
 *
19
 
 * Original author: Paul McCullagh (H&G2JCtL)
20
 
 * Continued development: Barry Leslie
21
 
 *
22
 
 * 2007-05-20
23
 
 *
24
 
 * A basic syncronized object.
25
 
 *
26
 
 */
27
 
 
28
 
#include "CSConfig.h"
29
 
 
30
 
#include <assert.h>
31
 
 
32
 
#include "CSGlobal.h"
33
 
#include "CSDefs.h"
34
 
#include "CSObject.h"
35
 
#include "CSMemory.h"
36
 
 
37
 
#ifdef DEBUG
38
 
#undef retain
39
 
#undef release
40
 
#endif
41
 
 
42
 
/*
43
 
 * ---------------------------------------------------------------
44
 
 * BASIC OBJECTS
45
 
 */
46
 
 
47
 
#ifdef DEBUG
48
 
void CSObject::retain(const char *func, const char *file, uint32_t line)
49
 
{
50
 
        CSException::throwAssertion(func, file, line, "Non-referenced object cannot be referenced");
51
 
}
52
 
#else
53
 
void CSObject::retain()
54
 
{
55
 
        CSException::throwAssertion(CS_CONTEXT, "Non-referenced object cannot be referenced");
56
 
}
57
 
#endif
58
 
 
59
 
#ifdef DEBUG
60
 
void CSObject::release(const char *, const char *, uint32_t )
61
 
#else
62
 
void CSObject::release()
63
 
#endif
64
 
{
65
 
        delete this;
66
 
}
67
 
 
68
 
CSObject *CSObject::getKey() { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return NULL; }
69
 
 
70
 
int CSObject::compareKey(CSObject *)  { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return 0; }
71
 
 
72
 
uint32_t CSObject::hashKey()  { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return 0; }
73
 
 
74
 
CSObject *CSObject::getHashLink() { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return NULL; }
75
 
 
76
 
void CSObject::setHashLink(CSObject *) { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); }
77
 
 
78
 
CSObject *CSObject::getNextLink() { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return NULL; }
79
 
 
80
 
CSObject *CSObject::getPrevLink() { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return NULL; }
81
 
 
82
 
void CSObject::setNextLink(CSObject *) { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); }
83
 
 
84
 
void CSObject::setPrevLink(CSObject *) { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); }
85
 
 
86
 
/*
87
 
 * ---------------------------------------------------------------
88
 
 * STATIC OBJECTS
89
 
 */
90
 
 
91
 
#ifdef DEBUG
92
 
void CSStaticObject::retain(const char *, const char *, uint32_t )
93
 
#else
94
 
void CSStaticObject::retain()
95
 
#endif
96
 
{
97
 
}
98
 
 
99
 
#ifdef DEBUG
100
 
void CSStaticObject::release(const char *, const char *, uint32_t )
101
 
#else
102
 
void CSStaticObject::release()
103
 
#endif
104
 
{
105
 
        finalize();
106
 
}
107
 
 
108
 
/*
109
 
 * ---------------------------------------------------------------
110
 
 * REFERENCE OBJECTS
111
 
 */
112
 
 
113
 
CSRefObject::CSRefObject():
114
 
CSObject(),
115
 
iRefCount(1)
116
 
{
117
 
#ifdef DEBUG
118
 
        iTrackMe = 0;
119
 
        cs_mm_track_memory(NULL, NULL, 0, this, true, iRefCount, iTrackMe);
120
 
#endif
121
 
}
122
 
 
123
 
CSRefObject::~CSRefObject()
124
 
{
125
 
        ASSERT(iRefCount == 0);
126
 
}
127
 
 
128
 
#ifdef DEBUG
129
 
void CSRefObject::retain(const char *func, const char *file, uint32_t line)
130
 
#else
131
 
void CSRefObject::retain()
132
 
#endif
133
 
{
134
 
        if (!iRefCount)
135
 
                CSException::throwAssertion(CS_CONTEXT, "Freed object being retained.");
136
 
                
137
 
        iRefCount++;
138
 
#ifdef DEBUG
139
 
        cs_mm_track_memory(func, file, line, this, true, iRefCount, iTrackMe);
140
 
#endif
141
 
}
142
 
 
143
 
#ifdef DEBUG
144
 
void CSRefObject::release(const char *func, const char *file, uint32_t line)
145
 
#else
146
 
void CSRefObject::release()
147
 
#endif
148
 
{
149
 
        bool terminate;
150
 
 
151
 
#ifdef DEBUG
152
 
        cs_mm_track_memory(func, file, line, this, false, iRefCount, iTrackMe);
153
 
#endif
154
 
        iRefCount--;
155
 
        if (!iRefCount)
156
 
                terminate = true;
157
 
        else
158
 
                terminate = false;
159
 
 
160
 
        if (terminate)
161
 
                delete this;
162
 
}
163
 
 
164
 
#ifdef DEBUG
165
 
void CSRefObject::startTracking()
166
 
{
167
 
        iTrackMe = 1;
168
 
        cs_mm_track_memory(NULL, NULL, 0, this, true, iRefCount, iTrackMe);
169
 
}
170
 
#endif
171
 
 
172
 
/*
173
 
 * ---------------------------------------------------------------
174
 
 * SHARED REFERENCE OBJECTS
175
 
 */
176
 
 
177
 
CSSharedRefObject::CSSharedRefObject():
178
 
CSObject(),
179
 
CSSync(),
180
 
iRefCount(1)
181
 
{
182
 
#ifdef DEBUG
183
 
        iTrackMe = 0;
184
 
        cs_mm_track_memory(NULL, NULL, 0, this, true, iRefCount, iTrackMe);
185
 
#endif
186
 
}
187
 
 
188
 
CSSharedRefObject::~CSSharedRefObject()
189
 
{
190
 
        ASSERT(iRefCount == 0);
191
 
}
192
 
 
193
 
#ifdef DEBUG
194
 
void CSSharedRefObject::retain(const char *func, const char *file, uint32_t line)
195
 
#else
196
 
void CSSharedRefObject::retain()
197
 
#endif
198
 
{
199
 
        lock();
200
 
        iRefCount++;
201
 
#ifdef DEBUG
202
 
        cs_mm_track_memory(func, file, line, this, true, iRefCount, iTrackMe);
203
 
#endif
204
 
        unlock();
205
 
}
206
 
 
207
 
#ifdef DEBUG
208
 
void CSSharedRefObject::release(const char *func, const char *file, uint32_t line)
209
 
#else
210
 
void CSSharedRefObject::release()
211
 
#endif
212
 
{
213
 
        bool terminate;
214
 
 
215
 
        lock();
216
 
#ifdef DEBUG
217
 
        cs_mm_track_memory(func, file, line, this, false, iRefCount, iTrackMe);
218
 
#endif
219
 
        iRefCount--;
220
 
        if (!iRefCount)
221
 
                terminate = true;
222
 
        else
223
 
                terminate = false;
224
 
        unlock();
225
 
 
226
 
        if (terminate)
227
 
                delete this;
228
 
}
229
 
 
230
 
#ifdef DEBUG
231
 
void CSSharedRefObject::startTracking()
232
 
{
233
 
        iTrackMe = 1;
234
 
        cs_mm_track_memory(NULL, NULL, 0, this, true, iRefCount, iTrackMe);
235
 
}
236
 
#endif
237
 
 
238
 
#ifdef DEBUG
239
 
/*
240
 
void CSSharedRefObject::retain(const char *func, const char *file, uint32_t line)
241
 
{
242
 
        lock();
243
 
        iRefCount++;
244
 
        cs_mm_print_track(func, file, line, this, true, iRefCount);
245
 
        unlock();
246
 
}
247
 
 
248
 
void CSSharedRefObject::release(const char *func, const char *file, uint32_t line)
249
 
{
250
 
        bool terminate;
251
 
 
252
 
        lock();
253
 
        cs_mm_track_memory(func, file, line, this, false, iRefCount, iTrackMe);
254
 
        iRefCount--;
255
 
        if (!iRefCount)
256
 
                terminate = true;
257
 
        else
258
 
                terminate = false;
259
 
        unlock();
260
 
 
261
 
        if (terminate)
262
 
                delete this;
263
 
}
264
 
*/
265
 
#endif
266
 
 
267