mirror of
https://github.com/darlinghq/darling-libxpc.git
synced 2024-11-23 11:49:42 +00:00
Use OSAtomic
This commit is contained in:
parent
711cfaa385
commit
48eef895be
@ -27,11 +27,11 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <xpc/xpc.h>
|
||||
#include <machine/atomic.h>
|
||||
#include <libkern/OSAtomic.h>
|
||||
#include <Block.h>
|
||||
#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);
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <machine/atomic.h>
|
||||
#include <libkern/OSAtomic.h>
|
||||
#include <assert.h>
|
||||
#include <syslog.h>
|
||||
#include <pthread.h>
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user