Home | History | Annotate | Download | only in mpreal

Lines Matching refs:sl

1662 #define INITIAL_LOCK(sl)      ((sl)->threadid = 0, (sl)->l = (sl)->c = 0, 0)

1663 #define ACQUIRE_LOCK(sl) pthread_acquire_lock(sl)
1664 #define RELEASE_LOCK(sl) pthread_release_lock(sl)
1665 #define TRY_LOCK(sl) pthread_try_lock(sl)
1670 static FORCEINLINE int pthread_acquire_lock (MLOCK_T *sl) {
1672 volatile unsigned int* lp = &sl->l;
1675 if (sl->threadid == CURRENT_THREAD) {
1676 ++sl->c;
1690 assert(!sl->threadid);
1691 sl->threadid = CURRENT_THREAD;
1692 sl->c = 1;
1710 static FORCEINLINE void pthread_release_lock (MLOCK_T *sl) {
1711 volatile unsigned int* lp = &sl->l;
1713 assert(sl->threadid == CURRENT_THREAD);
1714 if (--sl->c == 0) {
1715 sl->threadid = 0;
1725 static FORCEINLINE int pthread_try_lock (MLOCK_T *sl) {
1726 volatile unsigned int* lp = &sl->l;
1728 if (sl->threadid == CURRENT_THREAD) {
1729 ++sl->c;
1742 assert(!sl->threadid);
1743 sl->threadid = CURRENT_THREAD;
1744 sl->c = 1;
1762 #define INITIAL_LOCK(sl) ((sl)->threadid = 0, (sl)->l = (sl)->c = 0, 0)
1763 #define ACQUIRE_LOCK(sl) win32_acquire_lock(sl)
1764 #define RELEASE_LOCK(sl) win32_release_lock(sl)
1765 #define TRY_LOCK(sl) win32_try_lock(sl)
1770 static FORCEINLINE int win32_acquire_lock (MLOCK_T *sl) {
1773 if (sl->l != 0) {
1774 if (sl->threadid == CURRENT_THREAD) {
1775 ++sl->c;
1780 if (!interlockedexchange(&sl->l, 1)) {
1781 assert(!sl->threadid);
1782 sl->threadid = CURRENT_THREAD;
1783 sl->c = 1;
1792 static FORCEINLINE void win32_release_lock (MLOCK_T *sl) {
1793 assert(sl->threadid == CURRENT_THREAD);
1794 assert(sl->l != 0);
1795 if (--sl->c == 0) {
1796 sl->threadid = 0;
1797 interlockedexchange (&sl->l, 0);
1801 static FORCEINLINE int win32_try_lock (MLOCK_T *sl) {
1802 if (sl->l != 0) {
1803 if (sl->threadid == CURRENT_THREAD) {
1804 ++sl->c;
1809 if (!interlockedexchange(&sl->l, 1)){
1810 assert(!sl->threadid);
1811 sl->threadid = CURRENT_THREAD;
1812 sl->c = 1;
1827 #define INITIAL_LOCK(sl) pthread_init_lock(sl)
1828 #define ACQUIRE_LOCK(sl) pthread_mutex_lock(sl)
1829 #define RELEASE_LOCK(sl) pthread_mutex_unlock(sl)
1830 #define TRY_LOCK(sl) (!pthread_mutex_trylock(sl))
1845 static int pthread_init_lock (MLOCK_T *sl) {
1849 if (pthread_mutex_init(sl, &attr)) return 1;
1859 #define ACQUIRE_LOCK(s) (EnterCriticalSection(sl), 0)
1860 #define RELEASE_LOCK(s) LeaveCriticalSection(sl)
1861 #define TRY_LOCK(s) TryEnterCriticalSection(sl)
1892 /* #define INITIAL_LOCK(sl) ... */
1893 /* #define ACQUIRE_LOCK(sl) ... */
1894 /* #define RELEASE_LOCK(sl) ... */
1895 /* #define TRY_LOCK(sl) ... */