-/*
- * atomic.h: Atomic operations
+/**
+ * \file
+ * Atomic operations
*
* Author:
* Dick Porter (dick@ximian.com)
#endif
+#if SIZEOF_VOID_P == 4
+#define InterlockedAddP(p,add) InterlockedAdd ((volatile gint32*)p, (gint32)add)
+#else
+#define InterlockedAddP(p,add) InterlockedAdd64 ((volatile gint64*)p, (gint64)add)
+#endif
+
+/* The following functions cannot be found on any platform, and thus they can be declared without further existence checks */
+
+static inline void
+InterlockedWriteBool (volatile gboolean *dest, gboolean val)
+{
+ /* both, gboolean and gint32, are int32_t; the purpose of these casts is to make things explicit */
+ InterlockedWrite ((volatile gint32 *)dest, (gint32)val);
+}
+
#endif /* _WAPI_ATOMIC_H_ */