diff options
author | David Robillard <d@drobilla.net> | 2022-08-18 20:02:18 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-18 20:02:18 -0400 |
commit | 12cac42e31653323ec607ba3b6512fe9a734d083 (patch) | |
tree | c7d98780b43ba112a4df5898b1161c0bd3ec39bd /src | |
parent | 89d750689d7824066b9783da54186df3748a0ee0 (diff) | |
download | zix-12cac42e31653323ec607ba3b6512fe9a734d083.tar.gz zix-12cac42e31653323ec607ba3b6512fe9a734d083.tar.bz2 zix-12cac42e31653323ec607ba3b6512fe9a734d083.zip |
Add return status to zix_ring_mlock()
Diffstat (limited to 'src')
-rw-r--r-- | src/ring.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -14,7 +14,7 @@ # define ZIX_MLOCK(ptr, size) mlock((ptr), (size)) #elif defined(_WIN32) # include <windows.h> -# define ZIX_MLOCK(ptr, size) VirtualLock((ptr), (size)) +# define ZIX_MLOCK(ptr, size) !VirtualLock((ptr), (size)) #else # pragma message("warning: No memory locking, possible RT violations") # define ZIX_MLOCK(ptr, size) @@ -106,11 +106,12 @@ zix_ring_free(ZixRing* const ring) } } -void +ZixStatus zix_ring_mlock(ZixRing* const ring) { - ZIX_MLOCK(ring, sizeof(ZixRing)); - ZIX_MLOCK(ring->buf, ring->size); + return (ZIX_MLOCK(ring, sizeof(ZixRing)) || ZIX_MLOCK(ring->buf, ring->size)) + ? ZIX_STATUS_ERROR + : ZIX_STATUS_SUCCESS; } void |