Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
2000-07-19  Kaz Kylheku  <kaz@ashi.footprints.net>

	Bugfixes to the variant of the code for machines with no compare
	and swap.

	* spinlock.c (__pthread_alt_lock, __pthread_alt_timedlock): Wait
	node was not being properly enqueued, due to failing to update
	the lock->__status field.

	* spinlock.c (__pthread_alt_timedlock): The oldstatus variable was
	being set inappropriately, causing the suspend function to be called
	with a null self pointer and crash.
  • Loading branch information
Ulrich Drepper committed Jul 19, 2000
1 parent 5fca066 commit 80ec499
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 13 additions & 0 deletions linuxthreads/ChangeLog
@@ -1,3 +1,16 @@
2000-07-19 Kaz Kylheku <kaz@ashi.footprints.net>

Bugfixes to the variant of the code for machines with no compare
and swap.

* spinlock.c (__pthread_alt_lock, __pthread_alt_timedlock): Wait
node was not being properly enqueued, due to failing to update
the lock->__status field.

* spinlock.c (__pthread_alt_timedlock): The oldstatus variable was
being set inappropriately, causing the suspend function to be called
with a null self pointer and crash.

2000-07-18 Ulrich Drepper <drepper@redhat.com>

* spinlock.h (__pthread_alt_trylock): Fix code used if no
Expand Down
6 changes: 4 additions & 2 deletions linuxthreads/spinlock.c
Expand Up @@ -389,6 +389,7 @@ void __pthread_alt_lock(struct _pthread_fastlock * lock,
wait_node.abandoned = 0;
wait_node.next = (struct wait_node *) lock->__status;
wait_node.thr = self;
lock->__status = (long) &wait_node;
suspend_needed = 1;
}

Expand Down Expand Up @@ -434,7 +435,7 @@ void __pthread_alt_lock(struct _pthread_fastlock * lock,
int __pthread_alt_timedlock(struct _pthread_fastlock * lock,
pthread_descr self, const struct timespec *abstime)
{
long oldstatus;
long oldstatus = 0;
#if defined HAS_COMPARE_AND_SWAP
long newstatus;
#endif
Expand Down Expand Up @@ -462,11 +463,12 @@ int __pthread_alt_timedlock(struct _pthread_fastlock * lock,
p_wait_node->abandoned = 0;
p_wait_node->next = (struct wait_node *) lock->__status;
p_wait_node->thr = self;
lock->__status = (long) p_wait_node;
oldstatus = 1; /* force suspend */
}

WRITE_MEMORY_BARRIER();
lock->__spinlock = 0;
oldstatus = 1; /* force suspend */
goto suspend;
}
#endif
Expand Down

0 comments on commit 80ec499

Please sign in to comment.