summaryrefslogtreecommitdiff
path: root/rts/Pool.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2017-04-21 09:16:48 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-28 22:35:04 -0400
commit945c45ad50ed31e3acb96fdaafb21640c4669f12 (patch)
treeae2e59ba8d3a49bbd3c3dcece39d53aef691ed44 /rts/Pool.c
parente5b3492f23c2296d0d8221e1787ee585331f726e (diff)
downloadhaskell-945c45ad50ed31e3acb96fdaafb21640c4669f12.tar.gz
Prefer #if defined to #ifdef
Our new CPP linter enforces this.
Diffstat (limited to 'rts/Pool.c')
-rw-r--r--rts/Pool.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/rts/Pool.c b/rts/Pool.c
index 158391111b..d6ea0d492f 100644
--- a/rts/Pool.c
+++ b/rts/Pool.c
@@ -28,7 +28,7 @@ struct Pool_ {
/* how many things are currently allocated? (sum of lengths of available and
* taken lists) */
uint32_t current_size;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
/* signaled when a thing is released */
Condition cond;
#endif
@@ -37,7 +37,7 @@ struct Pool_ {
PoolEntry *available;
PoolEntry *taken;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
/* protects entire data structure */
Mutex mutex;
#endif
@@ -53,7 +53,7 @@ Pool *poolInit(uint32_t max_size, uint32_t desired_size,
pool->free_fn = free_fn;
pool->available = NULL;
pool->taken = NULL;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&pool->mutex);
initCondition(&pool->cond);
#endif
@@ -65,7 +65,7 @@ int poolFree(Pool *pool) {
return 1;
poolSetMaxSize(pool, 0);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
closeCondition(&pool->cond);
closeMutex(&pool->mutex);
#endif
@@ -145,7 +145,7 @@ void *poolTake(Pool *pool) {
while (ent == NULL) {
ent = poolTryTake_(pool);
if (!ent) {
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
waitCondition(&pool->cond, &pool->mutex);
#else
barf("Tried to take from an empty pool");
@@ -171,7 +171,7 @@ void poolRelease(Pool *pool, void *thing) {
} else {
ent->next = pool->available;
pool->available = ent;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
signalCondition(&pool->cond);
#endif
}