本文整理汇总了C++中s_unlock函数的典型用法代码示例。如果您正苦于以下问题:C++ s_unlock函数的具体用法?C++ s_unlock怎么用?C++ s_unlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了s_unlock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: aa_sdl_handle_event
AA_API int
aa_sdl_handle_event( const SDL_Event *event,
struct aa_sdl_display_params *params)
{
s_lock();
struct handler *r = NULL;
if( SDL_KEYDOWN == event->type ) {
/* search for key */
SDL_Keycode key = event->key.keysym.sym;
for( size_t i = 0; !r && i < s_key_vector.size; i ++ ) {
struct handler *h = s_key_vector.data[i];
if( key == h->key ) r = h;
}
} else {
/* search for event */
for( size_t i = 0; !r && i < s_event_vector.size; i ++ ) {
struct handler *h = s_event_vector.data[i];
if( event->type == h->event_type ) r = h;
}
}
s_unlock();
return (r
? r->handler(r->cx, params)
: -1);
}
开发者ID:golems,项目名称:amino,代码行数:29,代码来源:sdl_handler.c
示例2: mccp_hashmap_statistics
mccp_result_t
mccp_hashmap_statistics(mccp_hashmap_t *hmptr, const char **msgptr) {
mccp_result_t ret = MCCP_RESULT_ANY_FAILURES;
if (hmptr != NULL &&
*hmptr != NULL &&
msgptr != NULL) {
*msgptr = NULL;
s_read_lock(*hmptr);
{
if ((*hmptr)->m_is_operational == true) {
*msgptr = (const char *)HashStats(&((*hmptr)->m_hashtable));
if (*msgptr != NULL) {
ret = MCCP_RESULT_OK;
} else {
ret = MCCP_RESULT_NO_MEMORY;
}
} else {
ret = MCCP_RESULT_NOT_OPERATIONAL;
}
}
s_unlock(*hmptr);
} else {
ret = MCCP_RESULT_INVALID_ARGS;
}
return ret;
}
开发者ID:GPtpvWKrrZWERTEg,项目名称:mccp,代码行数:31,代码来源:hashmap.c
示例3: lagopus_cbuffer_is_empty
lagopus_result_t
lagopus_cbuffer_is_empty(lagopus_cbuffer_t *cbptr, bool *retptr) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
if (cbptr != NULL &&
*cbptr != NULL &&
retptr != NULL) {
*retptr = false;
s_lock(*cbptr);
{
if ((*cbptr)->m_is_operational == true) {
*retptr = ((*cbptr)->m_n_elements == 0) ? true : false;
ret = LAGOPUS_RESULT_OK;
} else {
ret = LAGOPUS_RESULT_NOT_OPERATIONAL;
}
}
s_unlock(*cbptr);
} else {
ret = LAGOPUS_RESULT_INVALID_ARGS;
}
return ret;
}
开发者ID:1514louluo,项目名称:lagopus,代码行数:26,代码来源:cbuffer.c
示例4: mccp_hashmap_clear
mccp_result_t
mccp_hashmap_clear(mccp_hashmap_t *hmptr, bool free_values) {
mccp_result_t ret = MCCP_RESULT_ANY_FAILURES;
if (hmptr != NULL &&
*hmptr != NULL) {
s_write_lock(*hmptr);
{
if ((*hmptr)->m_is_operational == true) {
(*hmptr)->m_is_operational = false;
s_reinit(*hmptr, free_values);
(*hmptr)->m_is_operational = true;
ret = MCCP_RESULT_OK;
} else {
ret = MCCP_RESULT_NOT_OPERATIONAL;
}
}
s_unlock(*hmptr);
} else {
ret = MCCP_RESULT_INVALID_ARGS;
}
return ret;
}
开发者ID:GPtpvWKrrZWERTEg,项目名称:mccp,代码行数:26,代码来源:hashmap.c
示例5: mccp_hashmap_iterate
mccp_result_t
mccp_hashmap_iterate(mccp_hashmap_t *hmptr,
mccp_hashmap_iteration_proc_t proc,
void *arg) {
mccp_result_t ret = MCCP_RESULT_ANY_FAILURES;
if (hmptr != NULL &&
*hmptr != NULL &&
proc != NULL) {
/*
* The proc could modify hash values so we use write lock.
*/
s_write_lock(*hmptr);
{
ret = s_iterate(hmptr, proc, arg);
}
s_unlock(*hmptr);
} else {
ret = MCCP_RESULT_INVALID_ARGS;
}
return ret;
}
开发者ID:GPtpvWKrrZWERTEg,项目名称:mccp,代码行数:25,代码来源:hashmap.c
示例6: lagopus_hashmap_iterate
lagopus_result_t
lagopus_hashmap_iterate(lagopus_hashmap_t *hmptr,
lagopus_hashmap_iteration_proc_t proc,
void *arg) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
if (hmptr != NULL &&
*hmptr != NULL &&
proc != NULL) {
int cstate;
/*
* The proc could modify hash values so we use write lock.
*/
s_write_lock(*hmptr, &cstate);
{
ret = s_iterate(hmptr, proc, arg);
}
s_unlock(*hmptr, cstate);
} else {
ret = LAGOPUS_RESULT_INVALID_ARGS;
}
return ret;
}
开发者ID:1514louluo,项目名称:lagopus,代码行数:26,代码来源:hashmap.c
示例7: lagopus_cbuffer_wait_puttable
lagopus_result_t
lagopus_cbuffer_wait_puttable(lagopus_cbuffer_t *cbptr,
lagopus_chrono_t nsec) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
int64_t remains;
if (cbptr != NULL && *cbptr != NULL) {
s_lock(*cbptr);
{
remains = (*cbptr)->m_n_max_elements - (*cbptr)->m_n_elements;
if (remains > 0) {
ret = (lagopus_result_t)remains;
} else {
ret = s_wait_puttable(*cbptr, nsec);
if (ret == LAGOPUS_RESULT_OK) {
ret = (*cbptr)->m_n_max_elements - (*cbptr)->m_n_elements;
}
}
}
s_unlock(*cbptr);
} else {
ret = LAGOPUS_RESULT_INVALID_ARGS;
}
return ret;
}
开发者ID:1514louluo,项目名称:lagopus,代码行数:28,代码来源:cbuffer.c
示例8: dummy_module_start
static lagopus_result_t
dummy_module_start(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
lagopus_msg_debug(5, "called.\n");
if (s_thd != NULL) {
s_lock();
{
if (s_is_initialized == true) {
ret = lagopus_thread_start(&s_thd, false);
if (ret == LAGOPUS_RESULT_OK) {
s_do_loop = true;
}
} else {
ret = LAGOPUS_RESULT_INVALID_STATE_TRANSITION;
}
}
s_unlock();
} else {
ret = LAGOPUS_RESULT_INVALID_OBJECT;
}
return ret;
}
开发者ID:AkiraSuu,项目名称:lagopus,代码行数:27,代码来源:dummy-module.c
示例9: s_do_log
static inline void
s_do_log(lagopus_log_level_t l, const char *msg) {
FILE *fd;
int o_cancel_state;
(void)pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &o_cancel_state);
s_lock();
switch (s_log_dst) {
case LAGOPUS_LOG_EMIT_TO_FILE:
case LAGOPUS_LOG_EMIT_TO_UNKNOWN: {
fd = (s_log_fd != NULL) ? s_log_fd : stderr;
(void)fprintf(fd, "%s", msg);
(void)fflush(fd);
break;
}
case LAGOPUS_LOG_EMIT_TO_SYSLOG: {
int prio = s_get_syslog_priority(l);
syslog(prio, "%s", msg);
}
}
s_unlock();
(void)pthread_setcancelstate(o_cancel_state, NULL);
}
开发者ID:D-TOKIOKA,项目名称:lagopus,代码行数:27,代码来源:logger.c
示例10: gallus_module_register
gallus_result_t
gallus_module_register(const char *name,
gallus_module_initialize_proc_t init_proc,
void *extarg,
gallus_module_start_proc_t start_proc,
gallus_module_shutdown_proc_t shutdown_proc,
gallus_module_stop_proc_t stop_proc,
gallus_module_finalize_proc_t finalize_proc,
gallus_module_usage_proc_t usage_proc) {
gallus_result_t ret = GALLUS_RESULT_ANY_FAILURES;
s_lock();
{
ret = s_register_module(name,
init_proc, extarg,
start_proc,
shutdown_proc,
stop_proc,
finalize_proc,
usage_proc);
}
s_unlock();
return ret;
}
开发者ID:uTnOJkji5quPSNE5,项目名称:gallus,代码行数:25,代码来源:module.c
示例11: dummy_module_shutdown
static lagopus_result_t
dummy_module_shutdown(shutdown_grace_level_t l) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
lagopus_msg_debug(5, "called.\n");
if (s_thd != NULL) {
s_lock();
{
if (s_is_initialized == true) {
if (l == SHUTDOWN_GRACEFULLY) {
s_is_gracefull = true;
}
s_do_loop = false;
ret = LAGOPUS_RESULT_OK;
} else {
ret = LAGOPUS_RESULT_INVALID_STATE_TRANSITION;
}
}
s_unlock();
} else {
ret = LAGOPUS_RESULT_INVALID_OBJECT;
}
return ret;
}
开发者ID:AkiraSuu,项目名称:lagopus,代码行数:28,代码来源:dummy-module.c
示例12: gallus_module_finalize_all
void
gallus_module_finalize_all(void) {
s_lock();
{
s_gstate = MODULE_GLOBAL_STATE_FINALIZING;
if (s_n_modules > 0) {
size_t i;
a_module *mptr;
/*
* Reverse order.
*/
for (i = 0; i < s_n_modules; i++) {
mptr = &(s_modules[s_n_modules - i - 1]);
s_finalize_module(mptr);
}
}
s_gstate = MODULE_GLOBAL_STATE_FINALIZED;
s_wakeup();
}
s_unlock();
}
开发者ID:uTnOJkji5quPSNE5,项目名称:gallus,代码行数:26,代码来源:module.c
示例13: lagopus_module_start_all
lagopus_result_t
lagopus_module_start_all(void) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
s_lock();
{
if (s_n_modules > 0) {
size_t i;
a_module *mptr;
for (ret = LAGOPUS_RESULT_OK, i = 0;
ret == LAGOPUS_RESULT_OK && i < s_n_modules;
i++) {
mptr = &(s_modules[i]);
ret = s_start_module(mptr);
if (ret != LAGOPUS_RESULT_OK) {
lagopus_perror(ret);
lagopus_msg_error("can't start module \"%s\".\n",
mptr->m_name);
}
}
} else {
ret = LAGOPUS_RESULT_OK;
}
}
s_unlock();
return ret;
}
开发者ID:D-TOKIOKA,项目名称:lagopus,代码行数:29,代码来源:module.c
示例14: lagopus_module_initialize_all
lagopus_result_t
lagopus_module_initialize_all(int argc, const char *const argv[]) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
s_lock();
{
if (s_n_modules > 0) {
size_t i;
a_module *mptr;
for (ret = LAGOPUS_RESULT_OK, i = 0;
ret == LAGOPUS_RESULT_OK && i < s_n_modules;
i++) {
mptr = &(s_modules[i]);
ret = s_initialize_module(mptr, argc, argv);
if (ret != LAGOPUS_RESULT_OK) {
lagopus_perror(ret);
lagopus_msg_error("can't initialize module \"%s\".\n",
mptr->m_name);
}
}
} else {
ret = LAGOPUS_RESULT_OK;
}
}
s_unlock();
return ret;
}
开发者ID:D-TOKIOKA,项目名称:lagopus,代码行数:29,代码来源:module.c
示例15: lagopus_cbuffer_clear
lagopus_result_t
lagopus_cbuffer_clear(lagopus_cbuffer_t *cbptr,
bool free_values) {
lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
if (cbptr != NULL &&
*cbptr != NULL) {
s_lock(*cbptr);
{
s_clean(*cbptr, free_values);
if ((*cbptr)->m_qmuxer != NULL &&
NEED_WAIT_READABLE((*cbptr)->m_type) == true) {
qmuxer_notify((*cbptr)->m_qmuxer);
}
(void)lagopus_cond_notify(&((*cbptr)->m_cond_put), true);
}
s_unlock(*cbptr);
ret = LAGOPUS_RESULT_OK;
} else {
ret = LAGOPUS_RESULT_INVALID_ARGS;
}
return ret;
}
开发者ID:1514louluo,项目名称:lagopus,代码行数:27,代码来源:cbuffer.c
示例16: lagopus_cbuffer_cancel_janitor
void
lagopus_cbuffer_cancel_janitor(lagopus_cbuffer_t *cbptr) {
if (cbptr != NULL &&
*cbptr != NULL) {
s_unlock(*cbptr);
}
}
开发者ID:1514louluo,项目名称:lagopus,代码行数:7,代码来源:cbuffer.c
示例17: global_state_reset
void
global_state_reset(void) {
s_lock();
{
s_gs = GLOBAL_STATE_UNKNOWN;
}
s_unlock();
}
开发者ID:1514louluo,项目名称:lagopus,代码行数:8,代码来源:gstate.c
示例18: AAADropAcctSession
/**
* Drop a given AAAAcctSession.
* @param s the accounting session to drop
*/
void AAADropAcctSession(AAAAcctSession* s) {
LOG(L_INFO, "INF: AAADropAcctSession\n");
if (s) {
AAAAcctSession *s1 = get_acc_session(s->dlgid);
if (!s1) {
LOG(L_ERR, "ERR: AAADropAcctSession: AAAAcctSession does not exist\n");
return;
}
unsigned int hash = get_acc_session_hash(s1->dlgid);
//del_acc_session(s);
s_unlock(hash);
}
}
开发者ID:asyn,项目名称:openvims,代码行数:17,代码来源:acct.c
示例19: gallus_module_shutdown_all
gallus_result_t
gallus_module_shutdown_all(shutdown_grace_level_t level) {
gallus_result_t ret = GALLUS_RESULT_ANY_FAILURES;
if (IS_VALID_SHUTDOWN(level) == true) {
s_lock();
{
s_gstate = MODULE_GLOBAL_STATE_SHUTTINGDOWN;
if (s_n_modules > 0) {
gallus_result_t first_err = GALLUS_RESULT_OK;
size_t i;
a_module *mptr;
/*
* Reverse order.
*/
for (i = 0; i < s_n_modules; i++) {
mptr = &(s_modules[s_n_modules - i - 1]);
ret = s_shutdown_module(mptr, level);
if (ret != GALLUS_RESULT_OK) {
gallus_perror(ret);
gallus_msg_error("can't shutdown module \"%s\".\n",
mptr->m_name);
if (first_err == GALLUS_RESULT_OK) {
first_err = ret;
}
}
/*
* Just carry on shutting down no matter what kind of errors
* occur.
*/
}
ret = first_err;
} else {
ret = GALLUS_RESULT_OK;
}
}
s_unlock();
} else {
ret = GALLUS_RESULT_INVALID_ARGS;
}
return ret;
}
开发者ID:uTnOJkji5quPSNE5,项目名称:gallus,代码行数:51,代码来源:module.c
示例20: dummy_module_finalize
static void
dummy_module_finalize(void) {
lagopus_msg_debug(5, "called.\n");
if (s_thd != NULL) {
s_lock();
{
lagopus_thread_destroy(&s_thd);
}
s_unlock();
}
}
开发者ID:AkiraSuu,项目名称:lagopus,代码行数:14,代码来源:dummy-module.c
注:本文中的s_unlock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论