sl 1532 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE int pthread_acquire_lock (MLOCK_T *sl) { sl 1533 oshmem/mca/memheap/ptmalloc/malloc.c if(CURRENT_THREAD==sl->threadid) sl 1534 oshmem/mca/memheap/ptmalloc/malloc.c ++sl->c; sl 1539 oshmem/mca/memheap/ptmalloc/malloc.c __asm__ __volatile__ ("lock cmpxchgl %2,(%1)" : "=a" (ret) : "r" (&sl->l), "r" (1), "a" (0)); sl 1541 oshmem/mca/memheap/ptmalloc/malloc.c dl_assert(!sl->threadid); sl 1542 oshmem/mca/memheap/ptmalloc/malloc.c sl->threadid=CURRENT_THREAD; sl 1543 oshmem/mca/memheap/ptmalloc/malloc.c sl->c=1; sl 1563 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE void pthread_release_lock (MLOCK_T *sl) { sl 1565 oshmem/mca/memheap/ptmalloc/malloc.c dl_assert(CURRENT_THREAD==sl->threadid); sl 1566 oshmem/mca/memheap/ptmalloc/malloc.c if (!--sl->c) { sl 1567 oshmem/mca/memheap/ptmalloc/malloc.c sl->threadid=0; sl 1568 oshmem/mca/memheap/ptmalloc/malloc.c __asm__ __volatile__ ("xchgl %2,(%1)" : "=r" (ret) : "r" (&sl->l), "0" (0)); sl 1572 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE int pthread_try_lock (MLOCK_T *sl) { sl 1574 oshmem/mca/memheap/ptmalloc/malloc.c __asm__ __volatile__ ("lock cmpxchgl %2,(%1)" : "=a" (ret) : "r" (&sl->l), "r" (1), "a" (0)); sl 1576 oshmem/mca/memheap/ptmalloc/malloc.c dl_assert(!sl->threadid); sl 1577 oshmem/mca/memheap/ptmalloc/malloc.c sl->threadid=CURRENT_THREAD; sl 1578 oshmem/mca/memheap/ptmalloc/malloc.c sl->c=1; sl 1584 oshmem/mca/memheap/ptmalloc/malloc.c #define INITIAL_LOCK(sl) (memset((sl), 0, sizeof(MLOCK_T)), 0) sl 1585 oshmem/mca/memheap/ptmalloc/malloc.c #define ACQUIRE_LOCK(sl) pthread_acquire_lock(sl) sl 1586 oshmem/mca/memheap/ptmalloc/malloc.c #define RELEASE_LOCK(sl) pthread_release_lock(sl) sl 1587 oshmem/mca/memheap/ptmalloc/malloc.c #define TRY_LOCK(sl) pthread_try_lock(sl) sl 1588 oshmem/mca/memheap/ptmalloc/malloc.c #define IS_LOCKED(sl) ((sl)->l) sl 1606 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE int win32_acquire_lock (MLOCK_T *sl) { sl 1608 oshmem/mca/memheap/ptmalloc/malloc.c if(mythreadid==sl->threadid) sl 1609 oshmem/mca/memheap/ptmalloc/malloc.c ++sl->c; sl 1613 oshmem/mca/memheap/ptmalloc/malloc.c if (!interlockedexchange(&sl->l, 1)) { sl 1614 oshmem/mca/memheap/ptmalloc/malloc.c dl_assert(!sl->threadid); sl 1615 oshmem/mca/memheap/ptmalloc/malloc.c sl->threadid=mythreadid; sl 1616 oshmem/mca/memheap/ptmalloc/malloc.c sl->c=1; sl 1626 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE void win32_release_lock (MLOCK_T *sl) { sl 1627 oshmem/mca/memheap/ptmalloc/malloc.c dl_assert(CURRENT_THREAD==sl->threadid); sl 1628 oshmem/mca/memheap/ptmalloc/malloc.c if (!--sl->c) { sl 1629 oshmem/mca/memheap/ptmalloc/malloc.c sl->threadid=0; sl 1630 oshmem/mca/memheap/ptmalloc/malloc.c interlockedexchange (&sl->l, 0); sl 1634 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE int win32_try_lock (MLOCK_T *sl) { sl 1635 oshmem/mca/memheap/ptmalloc/malloc.c if (!interlockedexchange(&sl->l, 1)){ sl 1636 oshmem/mca/memheap/ptmalloc/malloc.c dl_assert(!sl->threadid); sl 1637 oshmem/mca/memheap/ptmalloc/malloc.c sl->threadid=CURRENT_THREAD; sl 1638 oshmem/mca/memheap/ptmalloc/malloc.c sl->c=1; sl 1644 oshmem/mca/memheap/ptmalloc/malloc.c #define INITIAL_LOCK(sl) (memset(sl, 0, sizeof(MLOCK_T)), 0) sl 1645 oshmem/mca/memheap/ptmalloc/malloc.c #define ACQUIRE_LOCK(sl) win32_acquire_lock(sl) sl 1646 oshmem/mca/memheap/ptmalloc/malloc.c #define RELEASE_LOCK(sl) win32_release_lock(sl) sl 1647 oshmem/mca/memheap/ptmalloc/malloc.c #define TRY_LOCK(sl) win32_try_lock(sl) sl 1648 oshmem/mca/memheap/ptmalloc/malloc.c #define IS_LOCKED(sl) ((sl)->l) sl 1667 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE int pthread_acquire_lock (MLOCK_T *sl) { sl 1668 oshmem/mca/memheap/ptmalloc/malloc.c if(!pthread_mutex_lock(&(sl)->l)){ sl 1669 oshmem/mca/memheap/ptmalloc/malloc.c sl->c++; sl 1675 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE void pthread_release_lock (MLOCK_T *sl) { sl 1676 oshmem/mca/memheap/ptmalloc/malloc.c --sl->c; sl 1677 oshmem/mca/memheap/ptmalloc/malloc.c pthread_mutex_unlock(&(sl)->l); sl 1680 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE int pthread_try_lock (MLOCK_T *sl) { sl 1681 oshmem/mca/memheap/ptmalloc/malloc.c if(!pthread_mutex_trylock(&(sl)->l)){ sl 1682 oshmem/mca/memheap/ptmalloc/malloc.c sl->c++; sl 1688 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE int pthread_init_lock (MLOCK_T *sl) { sl 1690 oshmem/mca/memheap/ptmalloc/malloc.c sl->c=0; sl 1693 oshmem/mca/memheap/ptmalloc/malloc.c if(pthread_mutex_init(&sl->l, &attr)) return 1; sl 1698 oshmem/mca/memheap/ptmalloc/malloc.c static FORCEINLINE int pthread_islocked (MLOCK_T *sl) { sl 1699 oshmem/mca/memheap/ptmalloc/malloc.c if(!pthread_try_lock(sl)){ sl 1700 oshmem/mca/memheap/ptmalloc/malloc.c int ret = (sl->c != 0); sl 1701 oshmem/mca/memheap/ptmalloc/malloc.c pthread_mutex_unlock(sl); sl 1707 oshmem/mca/memheap/ptmalloc/malloc.c #define INITIAL_LOCK(sl) pthread_init_lock(sl) sl 1708 oshmem/mca/memheap/ptmalloc/malloc.c #define ACQUIRE_LOCK(sl) pthread_acquire_lock(sl) sl 1709 oshmem/mca/memheap/ptmalloc/malloc.c #define RELEASE_LOCK(sl) pthread_release_lock(sl) sl 1710 oshmem/mca/memheap/ptmalloc/malloc.c #define TRY_LOCK(sl) pthread_try_lock(sl) sl 1711 oshmem/mca/memheap/ptmalloc/malloc.c #define IS_LOCKED(sl) pthread_islocked(sl)