Skip to content

Commit 743d230

Browse files
committed
Remove old Spinlock implementation.
1 parent 3241a45 commit 743d230

File tree

2 files changed

+2
-72
lines changed

2 files changed

+2
-72
lines changed

src/common/classes/locks.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,7 @@
3838

3939
namespace Firebird {
4040

41-
#if defined(WIN_NT)
42-
43-
void Spinlock::init()
44-
{
45-
SetCriticalSectionSpinCount(&spinlock, 4000);
46-
}
47-
48-
#else //posix mutex
41+
#if !defined(WIN_NT)
4942

5043
pthread_mutexattr_t Mutex::attr;
5144

src/common/classes/locks.h

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ class Exception; // Needed for catch
5050

5151
#ifdef WIN_NT
5252

53-
// Generic process-local mutex and spinlock. The latter
54-
// is used to manage memory heaps in a threaded environment.
53+
// Generic process-local mutex.
5554

5655
// Windows version of the class
5756

@@ -151,23 +150,6 @@ class Mutex : public Reasons
151150
Mutex& operator=(const Mutex&);
152151
};
153152

154-
class Spinlock : public Mutex
155-
{
156-
private:
157-
void init();
158-
159-
public:
160-
Spinlock()
161-
{
162-
init();
163-
}
164-
165-
explicit Spinlock(MemoryPool&)
166-
{
167-
init();
168-
}
169-
};
170-
171153
#else //WIN_NT
172154

173155
// Pthreads version of the class
@@ -272,51 +254,6 @@ friend class Condition;
272254
Mutex& operator=(const Mutex&);
273255
};
274256

275-
#ifdef NOT_USED_OR_REPLACED // we do not use spinlocks currently
276-
class Spinlock
277-
{
278-
private:
279-
pthread_spinlock_t spinlock;
280-
public:
281-
Spinlock()
282-
{
283-
if (pthread_spin_init(&spinlock, false))
284-
system_call_failed::raise("pthread_spin_init");
285-
}
286-
287-
explicit Spinlock(MemoryPool&)
288-
{
289-
if (pthread_spin_init(&spinlock, false))
290-
system_call_failed::raise("pthread_spin_init");
291-
}
292-
293-
~Spinlock()
294-
{
295-
if (pthread_spin_destroy(&spinlock))
296-
system_call_failed::raise("pthread_spin_destroy");
297-
}
298-
299-
void enter()
300-
{
301-
if (pthread_spin_lock(&spinlock))
302-
system_call_failed::raise("pthread_spin_lock");
303-
}
304-
305-
void leave()
306-
{
307-
if (pthread_spin_unlock(&spinlock))
308-
system_call_failed::raise("pthread_spin_unlock");
309-
}
310-
311-
private:
312-
// Forbid copying
313-
Spinlock(const Spinlock&);
314-
Spinlock& operator=(const Spinlock&);
315-
};
316-
#else
317-
typedef Mutex Spinlock;
318-
#endif
319-
320257
#endif //WIN_NT
321258

322259

0 commit comments

Comments
 (0)