Lines Matching refs:barrier

58 static int SDL_CreateThreadBarrier(SDL_ThreadBarrier *barrier, Uint32 count)  in SDL_CreateThreadBarrier()  argument
60 if (barrier == NULL) { in SDL_CreateThreadBarrier()
67 barrier->mutex = SDL_CreateMutex(); in SDL_CreateThreadBarrier()
68 if (barrier->mutex == NULL) { in SDL_CreateThreadBarrier()
71 barrier->cond = SDL_CreateCond(); in SDL_CreateThreadBarrier()
72 if (barrier->cond == NULL) { in SDL_CreateThreadBarrier()
76 barrier->trip_count = count; in SDL_CreateThreadBarrier()
77 barrier->count = 0; in SDL_CreateThreadBarrier()
82 static void SDL_DestroyThreadBarrier(SDL_ThreadBarrier *barrier) in SDL_DestroyThreadBarrier() argument
84 SDL_DestroyCond(barrier->cond); in SDL_DestroyThreadBarrier()
85 SDL_DestroyMutex(barrier->mutex); in SDL_DestroyThreadBarrier()
88 static int SDL_WaitThreadBarrier(SDL_ThreadBarrier *barrier) in SDL_WaitThreadBarrier() argument
90 SDL_LockMutex(barrier->mutex); in SDL_WaitThreadBarrier()
91 barrier->count += 1; in SDL_WaitThreadBarrier()
92 if (barrier->count >= barrier->trip_count) { in SDL_WaitThreadBarrier()
93 barrier->count = 0; in SDL_WaitThreadBarrier()
94 SDL_CondBroadcast(barrier->cond); in SDL_WaitThreadBarrier()
95 SDL_UnlockMutex(barrier->mutex); in SDL_WaitThreadBarrier()
98 SDL_CondWait(barrier->cond, barrier->mutex); in SDL_WaitThreadBarrier()
99 SDL_UnlockMutex(barrier->mutex); in SDL_WaitThreadBarrier()
158 SDL_ThreadBarrier barrier; /* Ensures correct startup sequence */ member
179 SDL_CreateThreadBarrier(&dev->barrier, 2); in new_hid_device()
187 SDL_DestroyThreadBarrier(&dev->barrier); in free_hid_device()
876 SDL_WaitThreadBarrier(&dev->barrier); in read_thread()
1080 SDL_WaitThreadBarrier(&dev->barrier); in hid_open_path()