void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t*), void *param) { if (!obs) return; pthread_mutex_lock(&obs->data.user_sources_mutex); for (size_t i = 0; i < obs->data.user_sources.num; i++) { struct obs_source *source = obs->data.user_sources.array[i]; if (!enum_proc(param, source)) break; } pthread_mutex_unlock(&obs->data.user_sources_mutex); }
void obs_enum_sources(bool (*enum_proc)(obs_source_t, void*), void *param) { struct obs_data *data = &obs->data; size_t i; pthread_mutex_lock(&data->sources_mutex); for (i = 0; i < data->sources.num; i++) { if (!enum_proc(data->sources.array[i], param)) break; } pthread_mutex_unlock(&data->sources_mutex); }
static inline void obs_enum(void *pstart, pthread_mutex_t *mutex, void *proc, void *param) { struct obs_context_data **start = pstart, *context; bool (*enum_proc)(void*, void*) = proc; assert(start); assert(mutex); assert(enum_proc); pthread_mutex_lock(mutex); context = *start; while (context) { if (!enum_proc(param, context)) break; context = context->next; } pthread_mutex_unlock(mutex); }