From 48eef895bee3652672b427a92a4876d49f84fd5d Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Wed, 15 Feb 2017 15:15:02 +0300 Subject: [PATCH] Use OSAtomic --- xpc_connection.c | 4 ++-- xpc_misc.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xpc_connection.c b/xpc_connection.c index a55bf7a..279223b 100644 --- a/xpc_connection.c +++ b/xpc_connection.c @@ -27,11 +27,11 @@ #include #include -#include +#include #include #include "xpc_internal.h" -#define XPC_CONNECTION_NEXT_ID(conn) (atomic_fetchadd_long(&conn->xc_last_id, 1)) +#define XPC_CONNECTION_NEXT_ID(conn) OSAtomicIncrement64(&conn->xc_last_id) static void xpc_send(xpc_connection_t xconn, xpc_object_t message, uint64_t id); diff --git a/xpc_misc.c b/xpc_misc.c index 4ebc354..f190d48 100644 --- a/xpc_misc.c +++ b/xpc_misc.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -160,7 +160,7 @@ xpc_retain(xpc_object_t obj) struct xpc_object *xo; xo = obj; - atomic_add_int(&xo->xo_refcnt, 1); + OSAtomicIncrement32(&xo->xo_refcnt); return (obj); } @@ -170,7 +170,7 @@ xpc_release(xpc_object_t obj) struct xpc_object *xo; xo = obj; - if (atomic_fetchadd_int(&xo->xo_refcnt, -1) > 1) + if (OSAtomicDecrement32(&xo->xo_refcnt) > 1) return; xpc_object_destroy(xo);