Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces OSSpinLock with pthread_mutex_t #1953

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions src/core/basetypes/MCLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@
#ifndef mailcore2_MCLock_h
#define mailcore2_MCLock_h

#if __APPLE__

#include <libkern/OSAtomic.h>

#define MC_LOCK_TYPE OSSpinLock
#define MC_LOCK_INITIAL_VALUE OS_SPINLOCK_INIT
#define MC_LOCK(l) OSSpinLockLock(l)
#define MC_UNLOCK(l) OSSpinLockUnlock(l)

#else

#include <pthread.h>

#define MC_LOCK_TYPE pthread_mutex_t
Expand All @@ -28,5 +17,3 @@
#define MC_UNLOCK(l) pthread_mutex_unlock(l)

#endif

#endif
6 changes: 0 additions & 6 deletions src/core/basetypes/MCObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,12 @@ Object::Object()

Object::~Object()
{
#ifndef __APPLE__
pthread_mutex_destroy(&mLock);
#endif
}

void Object::init()
{
#if __APPLE__
mLock = OS_SPINLOCK_INIT;
#else
pthread_mutex_init(&mLock, NULL);
#endif
mCounter = 1;
}

Expand Down
4 changes: 0 additions & 4 deletions src/core/basetypes/MCObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ namespace mailcore {
public: // private

private:
#if __APPLE__
OSSpinLock mLock;
#else
pthread_mutex_t mLock;
#endif
int mCounter;
void init();
static void initObjectConstructors();
Expand Down