kni: fix multi-process support
[dpdk.git] / lib / librte_eal / common / include / rte_rwlock.h
index a0b5e01..ca1e30d 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  * 
- *   Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
  *   All rights reserved.
  * 
  *   Redistribution and use in source and binary forms, with or without 
@@ -30,7 +30,6 @@
  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * 
- *  version: DPDK.L.1.2.3-3
  */
 
 #ifndef _RTE_RWLOCK_H_
@@ -114,14 +113,7 @@ rte_rwlock_read_lock(rte_rwlock_t *rwl)
 static inline void
 rte_rwlock_read_unlock(rte_rwlock_t *rwl)
 {
-       /* in debug mode, we should check that rwl->cnt is > 0 */
-
-       /* same than atomic32_dec */
-       asm volatile(MPLOCKED
-                    "decl %[cnt]"
-                    : [cnt] "=m" (rwl->cnt) /* output (0) */
-                    : "m" (rwl->cnt)        /* input (1) */
-                    );                      /* no clobber-list */
+       rte_atomic32_dec((rte_atomic32_t *)(intptr_t)&rwl->cnt);
 }
 
 /**
@@ -157,14 +149,7 @@ rte_rwlock_write_lock(rte_rwlock_t *rwl)
 static inline void
 rte_rwlock_write_unlock(rte_rwlock_t *rwl)
 {
-       /* in debug mode, we should check that rwl->cnt is < 0 */
-
-       /* same than atomic32_inc */
-       asm volatile(MPLOCKED
-                    "incl %[cnt]"
-                    : [cnt] "=m" (rwl->cnt) /* output (0) */
-                    : "m" (rwl->cnt)        /* input (1) */
-                    );                      /* no clobber-list */
+       rte_atomic32_inc((rte_atomic32_t *)(intptr_t)&rwl->cnt);
 }
 
 #ifdef __cplusplus