+InterlockedExchangeAdd()
authorshort <>
Thu, 16 Jan 2003 03:45:22 +0000 (03:45 +0000)
committershort <>
Thu, 16 Jan 2003 03:45:22 +0000 (03:45 +0000)
src/libcaptive/halcaptive/intrlck.c

index 4a760a6..4ff7fbb 100644 (file)
@@ -61,6 +61,7 @@ LONG InterlockedDecrement(PLONG Subend)
        return --*Subend;
 }
 
+
 /**
  * InterlockedExchange:
  * @Target: Pointer to #LONG variable to exchange @Value with.
@@ -81,3 +82,25 @@ LONG r;
        *Target=Value;
        return r;
 }
+
+
+/**
+ * InterlockedExchangeAdd:
+ * @Addend: Pointer to #LONG variable to add @Value to.
+ * @Value: Value to add to @Addend value.
+ *
+ * Atomic value add of @Value to *@Addend.
+ * Currently libcaptive doesn't use multithreading
+ * and thus this function is just a simple value add now.
+ *
+ * Returns: Previous value of *@Addend;
+ */
+LONG InterlockedExchangeAdd(PLONG Addend,LONG Value)
+{
+LONG r;
+
+       /* TODO:thread */
+       r=*Addend;
+       *Addend+=Value;
+       return r;
+}