From bc320d151498a25734f17729afed26a109cb298b Mon Sep 17 00:00:00 2001 From: VilhoRaatikka Date: Mon, 15 Sep 2014 11:09:12 +0300 Subject: [PATCH] Cannot compile --- server/core/spinlock.c | 14 +++++++------- server/include/spinlock.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/core/spinlock.c b/server/core/spinlock.c index 7b35163f3..2e112e0b9 100644 --- a/server/core/spinlock.c +++ b/server/core/spinlock.c @@ -40,7 +40,7 @@ void spinlock_init(SPINLOCK *lock) { lock->lock = 0; -#ifdef SPINLOCK_PROFILE +#if defined(SPINLOCK_PROFILE) lock->spins = 0; lock->acquired = 0; lock->waiting = 0; @@ -57,7 +57,7 @@ spinlock_init(SPINLOCK *lock) void spinlock_acquire(SPINLOCK *lock) { -#ifdef SPINLOCK_PROFILE +#if defined(SPINLOCK_PROFILE) int spins = 0; atomic_add(&(lock->waiting), 1); @@ -65,12 +65,12 @@ int spins = 0; while (atomic_add(&(lock->lock), 1) != 0) { atomic_add(&(lock->lock), -1); -#ifdef SPINLOCK_PROFILE +#if defined(SPINLOCK_PROFILE) atomic_add(&(lock->spins), 1); spins++; #endif } -#ifdef SPINLOCK_PROFILE +#if defined(SPINLOCK_PROFILE) if (spins) { lock->contended++; @@ -97,7 +97,7 @@ spinlock_acquire_nowait(SPINLOCK *lock) atomic_add(&(lock->lock), -1); return FALSE; } -#ifdef SPINLOCK_PROFILE +#if defined(SPINLOCK_PROFILE) lock->acquired++; lock->owner = THREAD_SHELF(); #endif @@ -112,7 +112,7 @@ spinlock_acquire_nowait(SPINLOCK *lock) void spinlock_release(SPINLOCK *lock) { -#ifdef SPINLOCK_PROFILE +#if defined(SPINLOCK_PROFILE) if (lock->waiting > lock->max_waiting) lock->max_waiting = lock->waiting; #endif @@ -135,7 +135,7 @@ spinlock_release(SPINLOCK *lock) void spinlock_stats(SPINLOCK *lock, void (*reporter)(void *, char *, int), void *hdl) { -#ifdef SPINLOCK_PROFILE +#if defined(SPINLOCK_PROFILE) reporter(hdl, "Spinlock acquired", lock->acquired); if (lock->acquired) { diff --git a/server/include/spinlock.h b/server/include/spinlock.h index e5f938815..41b92769c 100644 --- a/server/include/spinlock.h +++ b/server/include/spinlock.h @@ -45,7 +45,7 @@ */ typedef struct spinlock { int lock; /*< Is the lock held? */ -#if SPINLOCK_PROFILE +#if defined(SPINLOCK_PROFILE) int spins; /*< Number of spins on this lock */ int maxspins; /*< Max no of spins to acquire lock */ int acquired; /*< No. of times lock was acquired */ @@ -63,7 +63,7 @@ typedef struct spinlock { #define FALSE false #endif -#if SPINLOCK_PROFILE +#if defined(SPINLOCK_PROFILE) #define SPINLOCK_INIT { 0, 0, 0, 0, 0, 0, 0, 0 } #else #define SPINLOCK_INIT { 0 }