本文整理汇总了C++中dt_pthread_mutex_unlock函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_pthread_mutex_unlock函数的具体用法?C++ dt_pthread_mutex_unlock怎么用?C++ dt_pthread_mutex_unlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_pthread_mutex_unlock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:kael-shipman,项目名称:darktable,代码行数:33,代码来源:jobs.c
示例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);
}
开发者ID:AlicVB,项目名称:darktable,代码行数:30,代码来源:levels.c
示例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;
}
开发者ID:fhrtms,项目名称:darktable,代码行数:7,代码来源:control.c
示例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;
}
开发者ID:kael-shipman,项目名称:darktable,代码行数:27,代码来源:jobs.c
示例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;
}
开发者ID:fhrtms,项目名称:darktable,代码行数:7,代码来源:control.c
示例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;
}
开发者ID:fhrtms,项目名称:darktable,代码行数:7,代码来源:control.c
示例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();
}
开发者ID:fhrtms,项目名称:darktable,代码行数:7,代码来源:control.c
示例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;
}
}
开发者ID:dtorop,项目名称:darktable,代码行数:25,代码来源:gui.c
示例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;
}
}
开发者ID:dtorop,项目名称:darktable,代码行数:25,代码来源:gui.c
示例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);
}
开发者ID:WhiteSymmetry,项目名称:darktable,代码行数:7,代码来源:lua.c
示例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);
}
开发者ID:itarozzi,项目名称:darktable,代码行数:7,代码来源:opencl.c
示例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);
}
}
开发者ID:CChiappa,项目名称:darktable,代码行数:33,代码来源:bilat.c
示例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;
}
开发者ID:andyTsing,项目名称:darktable,代码行数:8,代码来源:jobs.c
示例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);
}
开发者ID:joergbeyer,项目名称:darktable,代码行数:8,代码来源:darktable.c
示例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();
}
开发者ID:AdamMajer,项目名称:darktable,代码行数:8,代码来源:control.c
示例16: dt_lua_unlock
void dt_lua_unlock(gboolean relock_gdk)
{
dt_pthread_mutex_unlock(&darktable.lua_state.mutex);
if(relock_gdk)
{
dt_control_gdk_lock();
}
}
开发者ID:CaptainSifff,项目名称:darktable,代码行数:8,代码来源:lua.c
示例17: dt_get_wtime
// return read locked bucket, or NULL if it's not already there.
// never attempt to allocate a new slot.
dt_cache_entry_t *dt_cache_testget(dt_cache_t *cache, const uint32_t key, char mode)
{
gpointer orig_key, value;
gboolean res;
int result;
double start = dt_get_wtime();
dt_pthread_mutex_lock(&cache->lock);
res = g_hash_table_lookup_extended(
cache->hashtable, GINT_TO_POINTER(key), &orig_key, &value);
if(res)
{
dt_cache_entry_t *entry = (dt_cache_entry_t *)value;
// lock the cache entry
if(mode == 'w') result = dt_pthread_rwlock_trywrlock(&entry->lock);
else result = dt_pthread_rwlock_tryrdlock(&entry->lock);
if(result)
{ // need to give up mutex so other threads have a chance to get in between and
// free the lock we're trying to acquire:
dt_pthread_mutex_unlock(&cache->lock);
return 0;
}
// bubble up in lru list:
cache->lru = g_list_remove_link(cache->lru, entry->link);
cache->lru = g_list_concat(cache->lru, entry->link);
dt_pthread_mutex_unlock(&cache->lock);
double end = dt_get_wtime();
if(end - start > 0.1)
fprintf(stderr, "try+ wait time %.06fs mode %c \n", end - start, mode);
if(mode == 'w')
{
assert(entry->data_size);
ASAN_POISON_MEMORY_REGION(entry->data, entry->data_size);
}
// WARNING: do *NOT* unpoison here. it must be done by the caller!
return entry;
}
dt_pthread_mutex_unlock(&cache->lock);
double end = dt_get_wtime();
if(end - start > 0.1)
fprintf(stderr, "try- wait time %.06fs\n", end - start);
return 0;
}
开发者ID:CChiappa,项目名称:darktable,代码行数:47,代码来源:cache.c
示例18: dt_capabilities_add
void dt_capabilities_add(char *capability)
{
dt_pthread_mutex_lock(&darktable.capabilities_threadsafe);
if(!dt_capabilities_check(capability))
darktable.capabilities = g_list_append(darktable.capabilities, capability);
dt_pthread_mutex_unlock(&darktable.capabilities_threadsafe);
}
开发者ID:joergbeyer,项目名称:darktable,代码行数:9,代码来源:darktable.c
示例19: dt_camctl_unregister_listener
void dt_camctl_unregister_listener( const dt_camctl_t *c, dt_camctl_listener_t *listener)
{
dt_camctl_t *camctl=(dt_camctl_t *)c;
// Just locking mutex and prevent signalling CAMERA_CONTROL_BUSY
dt_pthread_mutex_lock(&camctl->lock);
dt_print(DT_DEBUG_CAMCTL,"[camera_control] unregistering listener %lx\n",(unsigned long int)listener);
camctl->listeners = g_list_remove( camctl->listeners, listener );
dt_pthread_mutex_unlock(&camctl->lock);
}
开发者ID:ammonriley,项目名称:darktable,代码行数:9,代码来源:camera_control.c
示例20: dt_control_progress_set_progress
void dt_control_progress_set_progress(dt_control_t *control, dt_progress_t *progress, double value)
{
// set the value
dt_pthread_mutex_lock(&progress->mutex);
progress->progress = value;
dt_pthread_mutex_unlock(&progress->mutex);
// tell the gui
dt_pthread_mutex_lock(&control->progress_system.mutex);
if(control->progress_system.proxy.module != NULL)
control->progress_system.proxy.updated(control->progress_system.proxy.module, progress->gui_data, value);
dt_pthread_mutex_unlock(&control->progress_system.mutex);
#ifdef HAVE_UNITY
if(progress->has_progress_bar)
unity_launcher_entry_set_progress(progress->darktable_launcher, CLAMP(value, 0, 1.0));
#endif
}
开发者ID:dtorop,项目名称:darktable,代码行数:18,代码来源:progress.c
注:本文中的dt_pthread_mutex_unlock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论