Lines Matching defs:spinlock
15 * 1. Initialize a pthread_spinlock_t object 'spinlock' with
17 * 2. Main thread lock 'spinlock', should get the lock
18 * 3. Create a child thread. The thread lock 'spinlock', should spin.
19 * 4. Main thread unlock 'spinlock'
20 * 5. Child thread should get 'spinlock'
31 static pthread_spinlock_t spinlock;
43 /* Lock the spinlock */
45 rc = pthread_spin_lock(&spinlock);
58 if(pthread_spin_unlock(&spinlock))
75 /* Initialize spinlock */
76 if(pthread_spin_init(&spinlock, PTHREAD_PROCESS_PRIVATE) != 0)
85 if(pthread_spin_lock(&spinlock) != 0)
121 if(pthread_spin_unlock(&spinlock) != 0)
151 /* Destroy the spinlock */
152 if(pthread_spin_destroy(&spinlock) != 0)