summaryrefslogtreecommitdiff
path: root/implement.h
diff options
context:
space:
mode:
authorrpj <rpj>2001-02-14 00:57:08 +0000
committerrpj <rpj>2001-02-14 00:57:08 +0000
commit0cf1781fea67a659ad3087abf39709b7f650a6ce (patch)
treed1f28f0919dde8afde2625aa978245444dee502d /implement.h
parent4b26627e3f31905f0f739d57947d49995aa81913 (diff)
Remove interdependence of mutex and cancel routines.
Diffstat (limited to 'implement.h')
-rw-r--r--implement.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/implement.h b/implement.h
index 41c220d..1addce6 100644
--- a/implement.h
+++ b/implement.h
@@ -119,27 +119,27 @@ struct pthread_attr_t_ {
*/
/*
- * The following macros provide exclusive access to an object's pointer.
+ * The following macros are used to serialise access to an object,
+ * including possibly before it is initialised.
* See mutex.c:pthread_mutex_lock() for an example.
*/
-#define PTW32_OBJECT_GET(type, ppObject, pDest) \
- while (((pDest) = (type) InterlockedCompareExchangePointer((PVOID *)(ppObject), \
- (PVOID)PTW32_OBJECT_IN_USE, \
- (PVOID)PTW32_OBJECT_IN_USE)) \
+#define PTW32_OBJECT_GET(type, pObject, Dest) \
+ while (((Dest) = (type) InterlockedExchange((LPLONG)(pObject), \
+ (LONG)PTW32_OBJECT_IN_USE)) \
== (type)PTW32_OBJECT_IN_USE) \
{ \
Sleep(0); \
}
-#define PTW32_OBJECT_SET(ppObject, value) \
- (void) InterlockedExchangePointer((PVOID *)(ppObject), (PVOID)(value))
+#define PTW32_OBJECT_SET(pObject, value) \
+ (void) InterlockedExchange((LPLONG)(pObject), (LONG)(value))
-#define PTW32_OBJECT_TRYGET(type, ppObject, pDest) \
- ((((pDest) = (type) InterlockedExchangePointer((PVOID *)(ppObject), \
- (PVOID)PTW32_OBJECT_IN_USE)) \
- == (type)PTW32_OBJECT_IN_USE) ? ((void) InterlockedExchangePointer((PVOID *)(ppObject), \
- (PVOID)(pDest)) , 0) \
+#define PTW32_OBJECT_TRYGET(type, pObject, Dest) \
+ ((((Dest) = (type) InterlockedExchange((LPLONG)(pObject), \
+ (LONG)PTW32_OBJECT_IN_USE)) \
+ == (type)PTW32_OBJECT_IN_USE) ? ((void) InterlockedExchange((LPLONG)(pObject), \
+ (LONG)(Dest)) , 0) \
: 1)
#define PTW32_OBJECT_IN_USE ((void *) -2)