本文整理汇总了C++中dt_pthread_mutex_unlock函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_pthread_mutex_unlock函数的具体用法?C++ dt_pthread_mutex_unlock怎么用?C++ dt_pthread_mutex_unlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_pthread_mutex_unlock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dt_control_jobs_init
// moved out of control.c to be able to make some helper functions static
void dt_control_jobs_init(dt_control_t *control)
{
// start threads
control->num_threads = CLAMP(dt_conf_get_int("worker_threads"), 1, 8);
control->thread = (pthread_t *)calloc(control->num_threads, sizeof(pthread_t));
control->job = (dt_job_t **)calloc(control->num_threads, sizeof(dt_job_t *));
dt_pthread_mutex_lock(&control->run_mutex);
control->running = 1;
dt_pthread_mutex_unlock(&control->run_mutex);
for(int k = 0; k < control->num_threads; k++)
{
worker_thread_parameters_t *params
= (worker_thread_parameters_t *)calloc(1, sizeof(worker_thread_parameters_t));
params->self = control;
params->threadid = k;
pthread_create(&control->thread[k], NULL, dt_control_work, params);
}
/* create queue kicker thread */
pthread_create(&control->kick_on_workers_thread, NULL, dt_control_worker_kicker, control);
for(int k = 0; k < DT_CTL_WORKER_RESERVED; k++)
{
control->job_res[k] = NULL;
control->new_res[k] = 0;
worker_thread_parameters_t *params
= (worker_thread_parameters_t *)calloc(1, sizeof(worker_thread_parameters_t));
params->self = control;
params->threadid = k;
pthread_create(&control->thread_res[k], NULL, dt_control_work_res, params);
}
}
示例2: gui_update
void gui_update(dt_iop_module_t *self)
{
dt_iop_levels_gui_data_t *g = (dt_iop_levels_gui_data_t *)self->gui_data;
dt_iop_levels_params_t *p = (dt_iop_levels_params_t *)self->params;
dt_bauhaus_combobox_set(g->mode, g_list_index(g->modes, GUINT_TO_POINTER(p->mode)));
dt_bauhaus_slider_set(g->percentile_black, p->percentiles[0]);
dt_bauhaus_slider_set(g->percentile_grey, p->percentiles[1]);
dt_bauhaus_slider_set(g->percentile_white, p->percentiles[2]);
switch(p->mode)
{
case LEVELS_MODE_AUTOMATIC:
gtk_stack_set_visible_child_name(GTK_STACK(g->mode_stack), "automatic");
break;
case LEVELS_MODE_MANUAL:
default:
gtk_stack_set_visible_child_name(GTK_STACK(g->mode_stack), "manual");
break;
}
dt_pthread_mutex_lock(&g->lock);
g->auto_levels[0] = NAN;
g->auto_levels[1] = NAN;
g->auto_levels[2] = NAN;
g->hash = 0;
dt_pthread_mutex_unlock(&g->lock);
gtk_widget_queue_draw(self->widget);
}
示例3: dt_control_get_dev_zoom
dt_dev_zoom_t dt_control_get_dev_zoom()
{
dt_pthread_mutex_lock(&(darktable.control->global_mutex));
dt_dev_zoom_t result = darktable.control->dev_zoom;
dt_pthread_mutex_unlock(&(darktable.control->global_mutex));
return result;
}
示例4: omp_set_num_threads
static void *dt_control_work_res(void *ptr)
{
#ifdef _OPENMP // need to do this in every thread
omp_set_num_threads(darktable.num_openmp_threads);
#endif
worker_thread_parameters_t *params = (worker_thread_parameters_t *)ptr;
dt_control_t *s = params->self;
threadid = params->threadid;
free(params);
int32_t threadid_res = dt_control_get_threadid_res();
while(dt_control_running())
{
// dt_print(DT_DEBUG_CONTROL, "[control_work] %d\n", threadid_res);
if(dt_control_run_job_res(s, threadid_res) < 0)
{
// wait for a new job.
int old;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old);
dt_pthread_mutex_lock(&s->cond_mutex);
dt_pthread_cond_wait(&s->cond, &s->cond_mutex);
dt_pthread_mutex_unlock(&s->cond_mutex);
int tmp;
pthread_setcancelstate(old, &tmp);
}
}
return NULL;
}
示例5: dt_control_get_dev_closeup
int dt_control_get_dev_closeup()
{
dt_pthread_mutex_lock(&(darktable.control->global_mutex));
int result = darktable.control->dev_closeup;
dt_pthread_mutex_unlock(&(darktable.control->global_mutex));
return result;
}
示例6: dt_control_get_mouse_over_id
int32_t dt_control_get_mouse_over_id()
{
dt_pthread_mutex_lock(&(darktable.control->global_mutex));
int32_t result = darktable.control->mouse_over_id;
dt_pthread_mutex_unlock(&(darktable.control->global_mutex));
return result;
}
示例7: dt_control_log_ack_all
static void dt_control_log_ack_all()
{
dt_pthread_mutex_lock(&darktable.control->log_mutex);
darktable.control->log_pos = darktable.control->log_ack;
dt_pthread_mutex_unlock(&darktable.control->log_mutex);
dt_control_queue_redraw_center();
}
示例8: lua_job_progress
static int lua_job_progress(lua_State *L)
{
dt_progress_t *progress;
luaA_to(L, dt_lua_backgroundjob_t, &progress, 1);
dt_pthread_mutex_lock(&darktable.control->progress_system.mutex);
GList *iter = g_list_find(darktable.control->progress_system.list, progress);
dt_pthread_mutex_unlock(&darktable.control->progress_system.mutex);
if(!iter) luaL_error(L, "Accessing an invalid job");
if(lua_isnone(L, 3))
{
double result = dt_control_progress_get_progress(progress);
if(!dt_control_progress_has_progress_bar(progress))
lua_pushnil(L);
else
lua_pushnumber(L, result);
return 1;
}
else
{
double value;
luaA_to(L, progress_double, &value, 3);
dt_control_progress_set_progress(darktable.control, progress, value);
return 0;
}
}
示例9: lua_job_valid
static int lua_job_valid(lua_State *L)
{
dt_progress_t *progress;
luaA_to(L, dt_lua_backgroundjob_t, &progress, 1);
if(lua_isnone(L, 3))
{
dt_pthread_mutex_lock(&darktable.control->progress_system.mutex);
GList *iter = g_list_find(darktable.control->progress_system.list, progress);
dt_pthread_mutex_unlock(&darktable.control->progress_system.mutex);
if(iter)
lua_pushboolean(L, true);
else
lua_pushboolean(L, false);
return 1;
}
else
{
int validity = lua_toboolean(L, 3);
if(validity) return luaL_argerror(L, 3, "a job can not be made valid");
dt_control_progress_destroy(darktable.control, progress);
return 0;
}
}
示例10: dt_lua_unlock_internal
void dt_lua_unlock_internal(const char *function, int line)
{
#ifdef _DEBUG
dt_print(DT_DEBUG_LUA,"LUA DEBUG : %s called from %s %d\n",__FUNCTION__,function,line);
#endif
dt_pthread_mutex_unlock(&darktable.lua_state.mutex);
}
示例11: dt_opencl_unlock_device
void dt_opencl_unlock_device(const int dev)
{
dt_opencl_t *cl = darktable.opencl;
if(!cl->inited) return;
if(dev < 0 || dev >= cl->num_devs) return;
dt_pthread_mutex_unlock(&cl->dev[dev].lock);
}
示例12: gui_update
/** gui callbacks, these are needed. */
void gui_update(dt_iop_module_t *self)
{
// let gui slider match current parameters:
dt_iop_bilat_gui_data_t *g = (dt_iop_bilat_gui_data_t *)self->gui_data;
dt_iop_bilat_params_t *p = (dt_iop_bilat_params_t *)self->params;
dt_bauhaus_slider_set(g->detail, 100.0f*p->detail+100.0f);
dt_bauhaus_combobox_set(g->mode, p->mode);
if(p->mode == s_mode_local_laplacian)
{
dt_bauhaus_slider_set(g->shadows, p->sigma_s*100.0f);
dt_bauhaus_slider_set(g->highlights, p->sigma_r*100.0f);
dt_bauhaus_slider_set(g->midtone, p->midtone);
gtk_widget_set_visible(g->range, FALSE);
gtk_widget_set_visible(g->spatial, FALSE);
gtk_widget_set_visible(g->highlights, TRUE);
gtk_widget_set_visible(g->shadows, TRUE);
gtk_widget_set_visible(g->midtone, TRUE);
dt_pthread_mutex_lock(&g->lock);
g->hash = 0;
dt_pthread_mutex_unlock(&g->lock);
}
else
{
dt_bauhaus_slider_set(g->spatial, p->sigma_s);
dt_bauhaus_slider_set(g->range, p->sigma_r);
gtk_widget_set_visible(g->range, TRUE);
gtk_widget_set_visible(g->spatial, TRUE);
gtk_widget_set_visible(g->highlights, FALSE);
gtk_widget_set_visible(g->shadows, FALSE);
gtk_widget_set_visible(g->midtone, FALSE);
}
}
示例13: dt_control_job_get_state
dt_job_state_t dt_control_job_get_state(_dt_job_t *job)
{
if(!job) return DT_JOB_STATE_DISPOSED;
dt_pthread_mutex_lock(&job->state_mutex);
dt_job_state_t state = job->state;
dt_pthread_mutex_unlock(&job->state_mutex);
return state;
}
示例14: dt_capabilities_remove
void dt_capabilities_remove(char *capability)
{
dt_pthread_mutex_lock(&darktable.capabilities_threadsafe);
darktable.capabilities = g_list_remove(darktable.capabilities, capability);
dt_pthread_mutex_unlock(&darktable.capabilities_threadsafe);
}
示例15: dt_control_log_busy_leave
void dt_control_log_busy_leave()
{
dt_pthread_mutex_lock(&darktable.control->log_mutex);
darktable.control->log_busy--;
dt_pthread_mutex_unlock(&darktable.control->log_mutex);
/* lets redraw */
dt_control_queue_redraw_center();
}