Lines Matching defs:spinlock
16 * 1. Create a piece of shared memory object, create a spin lock 'spinlock' and
18 * 2. Parent map the shared memory to its memory space, put 'spinlock' into it;
37 pthread_spinlock_t spinlock;
82 /* Initialize spinlock */
83 if((pthread_spin_init(&(spinlock_data->spinlock), pshared)) != 0)
90 if((pthread_spin_lock(&(spinlock_data->spinlock))) != 0)
97 /* Initialize spinlock data */
110 /* wait until child writes to spinlock data */
115 if(pthread_spin_unlock(&(spinlock_data->spinlock)) != 0)
150 if((pthread_spin_trylock(&(spinlock_data->spinlock))) != EBUSY)
160 /* Wait for parent to unlock spinlock */
167 if((pthread_spin_trylock(&(spinlock_data->spinlock))) != 0)
175 if(pthread_spin_unlock(&(spinlock_data->spinlock)) != 0)
181 if(pthread_spin_destroy(&(spinlock_data->spinlock)) != 0)