Unconditionaly initialize any spin lock passed to pthread_spin_init(). While
makeing sure the spinlock isn't already in use might be a nice feature to have in theory, it's hard to implement in practice since the passed in pointer may not be NULL, but still be an invalid value (i.e. 1..2..3.. etc).
This commit is contained in:
parent
97d114726d
commit
afa647196b
@ -80,10 +80,6 @@ _pthread_spin_init(pthread_spinlock_t *lock, int pshared)
|
||||
{
|
||||
struct pthread_spinlock *s;
|
||||
|
||||
if (*lock != NULL) {
|
||||
if ((*lock)->s_magic == THR_SPIN_MAGIC)
|
||||
return (EBUSY);
|
||||
}
|
||||
s = (struct pthread_spinlock *)malloc(sizeof(struct pthread_spinlock));
|
||||
if (s == NULL)
|
||||
return (ENOMEM);
|
||||
|
Loading…
Reference in New Issue
Block a user