From 6f490584c09ae29205a0ff62b771c30d1c533b66 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Wed, 8 Jan 2014 00:24:21 +0000 Subject: [PATCH] Define protected_int_value() macros to perform a thread-safe read of the current protected-interger value. --- src/xpdev/threadwrap.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/xpdev/threadwrap.h b/src/xpdev/threadwrap.h index 3beeea1fc9..7a4d96183b 100644 --- a/src/xpdev/threadwrap.h +++ b/src/xpdev/threadwrap.h @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2014 Rob Swindell - http://www.synchro.net/copyright.html * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -169,9 +169,13 @@ int protected_int64_init(protected_int64_t*, int64_t value); /* Return new value: */ int32_t protected_int32_adjust(protected_int32_t*, int32_t adjustment); +#define protected_int32_value(i) protected_int32_adjust(&i,0) uint32_t protected_uint32_adjust(protected_uint32_t*,int32_t adjustment); +#define protected_uint32_value(i) protected_uint32_adjust(&i,0) int64_t protected_int64_adjust(protected_int64_t*, int64_t adjustment); +#define protected_int64_value(i) protected_int64_adjust(&i,0) uint64_t protected_uint64_adjust(protected_uint64_t*,int64_t adjustment); +#define protected_uint64_value(i) protected_uint64_adjust(&i,0) /* Return 0 on success, non-zero on failure (see pthread_mutex_destroy): */ #define protected_int32_destroy(i) pthread_mutex_destroy(&i.mutex) -- GitLab