summaryrefslogtreecommitdiff
path: root/ptw32_InterlockedCompareExchange.c
diff options
context:
space:
mode:
authorrpj <rpj>2005-03-12 23:00:53 +0000
committerrpj <rpj>2005-03-12 23:00:53 +0000
commit47d030b0ab9adf502451ef1558eeca50e67063c0 (patch)
tree2754c946c36b276241e44208ad6d7f5c6cd45bce /ptw32_InterlockedCompareExchange.c
parent4ec6a9e7044d8c853d1cd734facb21316f850106 (diff)
New design for pthread_once (with cancelability); ABI change
Diffstat (limited to 'ptw32_InterlockedCompareExchange.c')
-rw-r--r--ptw32_InterlockedCompareExchange.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/ptw32_InterlockedCompareExchange.c b/ptw32_InterlockedCompareExchange.c
index 581d19d..5ffc754 100644
--- a/ptw32_InterlockedCompareExchange.c
+++ b/ptw32_InterlockedCompareExchange.c
@@ -204,12 +204,13 @@ ptw32_InterlockedExchange (LPLONG location,
* it doesn't lock the bus. If an interrupt or context switch
* occurs between the MOV and the CMPXCHG then the value in
* 'location' may have changed, in which case we will loop
- * back to do the MOV again. Because both instructions
- * reference the same location, they will not be re-ordered
- * in the pipeline.
+ * back to do the MOV again.
+ *
+ * FIXME! Need memory barriers for the MOV+CMPXCHG combo?
+ *
* Tests show that this routine has almost identical timing
* to Win32's InterlockedExchange(), which is much faster than
- * using the an inlined 'xchg' instruction, so it's probably
+ * using the inlined 'xchg' instruction above, so it's probably
* doing something similar to this (on UP systems).
*
* Can we do without the PUSH/POP instructions?
@@ -245,9 +246,10 @@ L1: MOV eax,dword ptr [ecx]
* it doesn't lock the bus. If an interrupt or context switch
* occurs between the movl and the cmpxchgl then the value in
* 'location' may have changed, in which case we will loop
- * back to do the movl again. Because both instructions
- * reference the same location, they will not be re-ordered
- * in the pipeline.
+ * back to do the movl again.
+ *
+ * FIXME! Need memory barriers for the MOV+CMPXCHG combo?
+ *
* Tests show that this routine has almost identical timing
* to Win32's InterlockedExchange(), which is much faster than
* using the an inlined 'xchg' instruction, so it's probably