summaryrefslogtreecommitdiff
path: root/pthread_mutex_timedlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'pthread_mutex_timedlock.c')
-rw-r--r--pthread_mutex_timedlock.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/pthread_mutex_timedlock.c b/pthread_mutex_timedlock.c
index 3f759b5..14843af 100644
--- a/pthread_mutex_timedlock.c
+++ b/pthread_mutex_timedlock.c
@@ -138,13 +138,13 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex,
{
if (mx->kind == PTHREAD_MUTEX_NORMAL)
{
- if ((LONG) PTW32_INTERLOCKED_EXCHANGE(
- (LPLONG) &mx->lock_idx,
- (LONG) 1) != 0)
+ if ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+ (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+ (PTW32_INTERLOCKED_VALUE) 1) != 0)
{
- while ((LONG) PTW32_INTERLOCKED_EXCHANGE(
- (LPLONG) &mx->lock_idx,
- (LONG) -1) != 0)
+ while ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+ (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+ (PTW32_INTERLOCKED_VALUE) -1) != 0)
{
if (0 != (result = ptw32_timed_eventwait (mx->event, abstime)))
{
@@ -157,10 +157,10 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex,
{
pthread_t self = pthread_self();
- if ((PTW32_INTERLOCKED_LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE(
- (PTW32_INTERLOCKED_LPLONG) &mx->lock_idx,
- (PTW32_INTERLOCKED_LONG) 1,
- (PTW32_INTERLOCKED_LONG) 0) == 0)
+ if ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_COMPARE_EXCHANGE(
+ (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+ (PTW32_INTERLOCKED_VALUE) 1,
+ (PTW32_INTERLOCKED_VALUE) 0) == 0)
{
mx->recursive_count = 1;
mx->ownerThread = self;
@@ -180,9 +180,9 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex,
}
else
{
- while ((LONG) PTW32_INTERLOCKED_EXCHANGE(
- (LPLONG) &mx->lock_idx,
- (LONG) -1) != 0)
+ while ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+ (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+ (PTW32_INTERLOCKED_VALUE) -1) != 0)
{
if (0 != (result = ptw32_timed_eventwait (mx->event, abstime)))
{
@@ -205,9 +205,9 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex,
*/
ptw32_robust_state_t* statePtr = &mx->robustNode->stateInconsistent;
- if ((LONG)PTW32_ROBUST_NOTRECOVERABLE == PTW32_INTERLOCKED_EXCHANGE_ADD(
- (LPLONG)statePtr,
- 0L))
+ if ((PTW32_INTERLOCKED_VALUE)PTW32_ROBUST_NOTRECOVERABLE == PTW32_INTERLOCKED_EXCHANGE_ADD(
+ (PTW32_INTERLOCKED_PTR)statePtr,
+ (PTW32_INTERLOCKED_VALUE)0))
{
result = ENOTRECOVERABLE;
}
@@ -219,23 +219,23 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex,
if (PTHREAD_MUTEX_NORMAL == kind)
{
- if ((LONG) PTW32_INTERLOCKED_EXCHANGE(
- (LPLONG) &mx->lock_idx,
- (LONG) 1) != 0)
+ if ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+ (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+ (PTW32_INTERLOCKED_VALUE) 1) != 0)
{
while (0 == (result = ptw32_robust_mutex_inherit(mutex))
- && (LONG) PTW32_INTERLOCKED_EXCHANGE(
- (LPLONG) &mx->lock_idx,
- (LONG) -1) != 0)
+ && (PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+ (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+ (PTW32_INTERLOCKED_VALUE) -1) != 0)
{
if (0 != (result = ptw32_timed_eventwait (mx->event, abstime)))
{
return result;
}
- if ((LONG)PTW32_ROBUST_NOTRECOVERABLE ==
+ if ((PTW32_INTERLOCKED_VALUE)PTW32_ROBUST_NOTRECOVERABLE ==
PTW32_INTERLOCKED_EXCHANGE_ADD(
- (LPLONG)statePtr,
- 0L))
+ (PTW32_INTERLOCKED_PTR)statePtr,
+ (PTW32_INTERLOCKED_VALUE)0))
{
/* Unblock the next thread */
SetEvent(mx->event);
@@ -258,10 +258,10 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex,
{
pthread_t self = pthread_self();
- if ((PTW32_INTERLOCKED_LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE(
- (PTW32_INTERLOCKED_LPLONG) &mx->lock_idx,
- (PTW32_INTERLOCKED_LONG) 1,
- (PTW32_INTERLOCKED_LONG) 0) == 0)
+ if (0 == (PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_COMPARE_EXCHANGE(
+ (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+ (PTW32_INTERLOCKED_VALUE) 1,
+ (PTW32_INTERLOCKED_VALUE) 0))
{
mx->recursive_count = 1;
/*
@@ -286,9 +286,9 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex,
else
{
while (0 == (result = ptw32_robust_mutex_inherit(mutex))
- && (LONG) PTW32_INTERLOCKED_EXCHANGE(
- (LPLONG) &mx->lock_idx,
- (LONG) -1) != 0)
+ && (PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+ (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+ (PTW32_INTERLOCKED_VALUE) -1) != 0)
{
if (0 != (result = ptw32_timed_eventwait (mx->event, abstime)))
{
@@ -296,10 +296,10 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex,
}
}
- if ((LONG)PTW32_ROBUST_NOTRECOVERABLE ==
+ if ((PTW32_INTERLOCKED_VALUE)PTW32_ROBUST_NOTRECOVERABLE ==
PTW32_INTERLOCKED_EXCHANGE_ADD(
- (LPLONG)statePtr,
- 0L))
+ (PTW32_INTERLOCKED_PTR)statePtr,
+ (PTW32_INTERLOCKED_VALUE)0))
{
/* Unblock the next thread */
SetEvent(mx->event);