Lines Matching refs:ssync

136     struct state_sync *ssync;  in init_state_sync_obj()  local
138 ssync = (struct state_sync*)mmap(NULL, sizeof(struct state_sync), in init_state_sync_obj()
140 if (ssync == MAP_FAILED) { in init_state_sync_obj()
147 pthread_mutex_init(&ssync->mutex, &mattr); in init_state_sync_obj()
152 pthread_cond_init(&ssync->condition, &cattr); in init_state_sync_obj()
154 ssync->state = STATE_INIT; in init_state_sync_obj()
155 return ssync; in init_state_sync_obj()
158 void destroy_state_sync_obj(struct state_sync *ssync) { in destroy_state_sync_obj() argument
159 pthread_cond_destroy(&ssync->condition); in destroy_state_sync_obj()
160 pthread_mutex_destroy(&ssync->mutex); in destroy_state_sync_obj()
161 munmap(ssync, sizeof(struct state_sync)); in destroy_state_sync_obj()
164 void signal_state(struct state_sync *ssync, int state) { in signal_state() argument
165 pthread_mutex_lock(&ssync->mutex); in signal_state()
166 ssync->state = state; in signal_state()
167 pthread_cond_signal(&ssync->condition); in signal_state()
168 pthread_mutex_unlock(&ssync->mutex); in signal_state()
171 void wait_for_state(struct state_sync *ssync, int state) { in wait_for_state() argument
172 pthread_mutex_lock(&ssync->mutex); in wait_for_state()
173 while (ssync->state != state) { in wait_for_state()
174 pthread_cond_wait(&ssync->condition, &ssync->mutex); in wait_for_state()
176 pthread_mutex_unlock(&ssync->mutex); in wait_for_state()
214 struct state_sync *ssync; in runMemStressTest() local
238 ASSERT_FALSE((ssync = init_state_sync_obj()) == NULL) in runMemStressTest()
250 wait_for_state(ssync, STATE_CHILD_READY); in runMemStressTest()
258 signal_state(ssync, STATE_PARENT_READY); in runMemStressTest()
279 signal_state(ssync, STATE_CHILD_READY); in runMemStressTest()
280 wait_for_state(ssync, STATE_PARENT_READY); in runMemStressTest()
287 destroy_state_sync_obj(ssync); in runMemStressTest()