本文整理汇总了C++中release_context函数的典型用法代码示例。如果您正苦于以下问题:C++ release_context函数的具体用法?C++ release_context怎么用?C++ release_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了release_context函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ibmca_finish
static int ibmca_finish(ENGINE *e)
{
if(ibmca_dso == NULL)
{
IBMCAerr(IBMCA_F_IBMCA_FINISH,IBMCA_R_NOT_LOADED);
return 0;
}
release_context(handle);
if(!DSO_free(ibmca_dso))
{
IBMCAerr(IBMCA_F_IBMCA_FINISH,IBMCA_R_DSO_FAILURE);
return 0;
}
ibmca_dso = NULL;
return 1;
}
开发者ID:x684867,项目名称:nemesis,代码行数:33,代码来源:hw_ibmca.c
示例2: hwcrhk_finish
static int hwcrhk_finish(ENGINE *e)
{
int to_return = 1;
free_HWCRHK_LIBNAME();
if(hwcrhk_dso == NULL)
{
HWCRHKerr(HWCRHK_F_HWCRHK_FINISH,HWCRHK_R_NOT_LOADED);
to_return = 0;
goto err;
}
release_context(hwcrhk_context);
if(!DSO_free(hwcrhk_dso))
{
HWCRHKerr(HWCRHK_F_HWCRHK_FINISH,HWCRHK_R_DSO_FAILURE);
to_return = 0;
goto err;
}
err:
if (logstream)
BIO_free(logstream);
hwcrhk_dso = NULL;
p_hwcrhk_Init = NULL;
p_hwcrhk_Finish = NULL;
p_hwcrhk_ModExp = NULL;
#ifndef OPENSSL_NO_RSA
p_hwcrhk_RSA = NULL;
p_hwcrhk_RSALoadKey = NULL;
p_hwcrhk_RSAGetPublicKey = NULL;
p_hwcrhk_RSAUnloadKey = NULL;
#endif
p_hwcrhk_ModExpCRT = NULL;
p_hwcrhk_RandomBytes = NULL;
return to_return;
}
开发者ID:SibghatullahSheikh,项目名称:voip-client-ios,代码行数:34,代码来源:e_chil.c
示例3: main
int
main(void)
{
context_t *context = alloc_context();
if (!context)
{
printf("T: Failed to create new context.\n");
return 1;
}
for (int i = 0; i < 5; i++)
{
measurement_t measurement;
if (measure(context, &measurement) == 0)
{
printf("T: Time = %.1u, Value = %.3f\n",
measurement.time, measurement.value);
}
else
{
printf("T: Failed to obtain measurement.\n");
}
}
if (release_context(context) != 0)
{
printf("T: Failed to release context.\n");
return 1;
}
return 0;
}
开发者ID:mjhanninen,项目名称:hs-ffi-example,代码行数:29,代码来源:test_frobnicator.c
示例4: cb_Exit
HOT_INLINE
static void cb_Exit(
hot_contextID_t id,
unsigned *cs
) {
hot_context_t s;
hot_ens_Exit_cback exit_cb;
void *env;
begin_critical(); {
s = lookup_context(id);
if (!s->leaving)
hot_sys_Panic("hot_ens_Exit_cbd: mbr state is not leaving");
env = s->env;
exit_cb = s->conf.exit;
} end_critical();
if (exit_cb != NULL) {
(*exit_cb)(s, env);
}
begin_critical(); {
release_context(s);
} end_critical();
}
开发者ID:4og,项目名称:avango,代码行数:25,代码来源:hot_outboard_c.c
示例5: main
int main( int argc, char **argv )
{
if(argc == 1)
{
printf("usage: %s shader.glsl [mesh.obj] [texture0.png [texture1.png]]\n", argv[0]);
return 0;
}
Window window= create_window(1024, 640);
if(window == NULL)
return 1;
Context context= create_context(window);
if(context == NULL)
return 1;
// creation des objets opengl
std::vector<const char *> options(argv + 1, argv + argc);
if(init(options) < 0)
{
printf("[error] init failed.\n");
return 1;
}
// affichage de l'application
run(window, draw);
// nettoyage
quit();
release_context(context);
release_window(window);
return 0;
}
开发者ID:PierreCAMILLI,项目名称:mif23-projet,代码行数:33,代码来源:shader_kit.cpp
示例6: main
int main( int argc, char **argv )
{
// etape 1 : creer la fenetre
Window window= create_window(1024, 640);
if(window == NULL)
return 1; // erreur lors de la creation de la fenetre ou de l'init de sdl2
// etape 2 : creer un contexte opengl pour pouvoir dessiner
Context context= create_context(window);
if(context == NULL)
return 1; // erreur lors de la creation du contexte opengl
// etape 3 : creation des objets
if(init() < 0)
{
printf("[error] init failed.\n");
return 1;
}
// etape 4 : affichage de l'application, tant que la fenetre n'est pas fermee. ou que draw() ne renvoie pas 0
run(window, draw);
// etape 5 : nettoyage
quit();
release_context(context);
release_window(window);
return 0;
}
开发者ID:PierreCAMILLI,项目名称:mif23-projet,代码行数:28,代码来源:tuto4.cpp
示例7: cswift_init
/* (de)initialisation functions. */
static int cswift_init(ENGINE *e)
{
SW_CONTEXT_HANDLE hac;
t_swAcquireAccContext *p1;
t_swAttachKeyParam *p2;
t_swSimpleRequest *p3;
t_swReleaseAccContext *p4;
if(cswift_dso != NULL)
{
CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_ALREADY_LOADED);
goto err;
}
/* Attempt to load libswift.so/swift.dll/whatever. */
cswift_dso = DSO_load(NULL, get_CSWIFT_LIBNAME(), NULL, 0);
if(cswift_dso == NULL)
{
CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_NOT_LOADED);
goto err;
}
if(!(p1 = (t_swAcquireAccContext *)
DSO_bind_func(cswift_dso, CSWIFT_F1)) ||
!(p2 = (t_swAttachKeyParam *)
DSO_bind_func(cswift_dso, CSWIFT_F2)) ||
!(p3 = (t_swSimpleRequest *)
DSO_bind_func(cswift_dso, CSWIFT_F3)) ||
!(p4 = (t_swReleaseAccContext *)
DSO_bind_func(cswift_dso, CSWIFT_F4)))
{
CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_NOT_LOADED);
goto err;
}
/* Copy the pointers */
p_CSwift_AcquireAccContext = p1;
p_CSwift_AttachKeyParam = p2;
p_CSwift_SimpleRequest = p3;
p_CSwift_ReleaseAccContext = p4;
/* Try and get a context - if not, we may have a DSO but no
* accelerator! */
if(!get_context(&hac))
{
CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_UNIT_FAILURE);
goto err;
}
release_context(hac);
/* Everything's fine. */
return 1;
err:
if(cswift_dso)
{
DSO_free(cswift_dso);
cswift_dso = NULL;
}
p_CSwift_AcquireAccContext = NULL;
p_CSwift_AttachKeyParam = NULL;
p_CSwift_SimpleRequest = NULL;
p_CSwift_ReleaseAccContext = NULL;
return 0;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:60,代码来源:e_cswift.c
示例8: check_call
booster::shared_ptr<json_call> json_rpc_server::release_call()
{
check_call();
current_call_->attach_context(release_context());
booster::shared_ptr<json_call> call = current_call_;
current_call_.reset();
return call;
}
开发者ID:klupek,项目名称:cppcms,代码行数:8,代码来源:rpc_json.cpp
示例9: single
void single()
{
calls ++;
std::ostream &out = response().out();
for(unsigned i=0;i<10000000;i++) {
out << i << '\n';
}
release_context()->async_complete_response();
}
开发者ID:klupek,项目名称:cppcms,代码行数:9,代码来源:disco_test.cpp
示例10: multiple
void multiple()
{
calls ++;
binder call;
call.context = release_context();
call.counter = 10000;
call(cppcms::http::context::operation_completed);
}
开发者ID:klupek,项目名称:cppcms,代码行数:9,代码来源:disco_test.cpp
示例11: kherr_release_context
/* Should NOT be called with cs_error held */
KHMEXP void KHMAPI
kherr_release_context(kherr_context * c)
{
if (!IS_KHERR_CTX(c))
return;
EnterCriticalSection(&cs_error);
release_context(c);
LeaveCriticalSection(&cs_error);
}
开发者ID:secure-endpoints,项目名称:netidmgr,代码行数:11,代码来源:kherr.c
示例12: response
void json_rpc_server::main(std::string /*unused*/)
{
if(!smd_.empty() && request().request_method()=="GET") {
response().set_content_header("application/json");
response().out() << smd_;
if(is_asynchronous())
release_context()->async_complete_response();
return;
}
try {
current_call_.reset(new json_call(context()));
methods_map_type::iterator p=methods_.find(method());
if(p==methods_.end()) {
if(!notification())
return_error("Method not found");
return;
}
if(p->second.role == notification_role && !notification()) {
return_error("The request should be notification");
return;
}
if(p->second.role == method_role && notification()) {
// No way to respond according to protocol
return;
}
try {
p->second.method(params());
}
catch(json::bad_value_cast const &e) {
if(current_call_.get() && !notification())
return_error("Invalid parameters");
return;
}
catch(call_error const &e) {
if(current_call_.get() && !notification())
return_error(e.what());
return;
}
catch(std::exception const &e) {
if(current_call_.get() && !notification())
return_error("Internal Service Error");
return;
}
}
catch(call_error const &e)
{
response().set_content_header("text/plain");
response().out()<< e.what() << std::endl;
}
}
开发者ID:klupek,项目名称:cppcms,代码行数:53,代码来源:rpc_json.cpp
示例13: kherr_pop_context
/* Should NOT be called with cs_error held */
KHMEXP void KHMAPI
kherr_pop_context(void)
{
kherr_context * c;
EnterCriticalSection(&cs_error);
c = pop_context();
if(IS_KHERR_CTX(c)) {
release_context(c);
}
LeaveCriticalSection(&cs_error);
}
开发者ID:secure-endpoints,项目名称:netidmgr,代码行数:13,代码来源:kherr.c
示例14: release_context
/* MUST be called with cs_error held */
static void
release_context(kherr_context * c)
{
if (IS_KHERR_CTX(c)) {
c->refcount--;
{
kherr_event * e;
e = QBOTTOM(c);
if (IS_KHERR_EVENT(e) && !(e->flags & KHERR_RF_COMMIT)) {
commit_event(c, e);
}
}
if (c->refcount == 0) {
kherr_context * p;
if (CTX_USES_OWN_PROGRESS(c)) {
set_and_notify_progress_change(c, 256, 256);
}
p = TPARENT(c);
#ifdef DEBUG
kherr_debug_printf(L"Posting KHERR_CTX_END for %p\n", (void *) c);
#endif
notify_ctx_event(KHERR_CTX_END, c, NULL, NULL, 0);
if (IS_KHERR_CTX(p)) {
kherr_event * e;
e = fold_context(c);
TDELCHILD(p, c);
if (e) {
add_event(p, e);
notify_ctx_event(KHERR_CTX_FOLDCHILD, p, NULL, e, 0);
}
release_context(p);
} else {
LDELETE(&ctx_root_list, c);
}
free_context(c);
}
}
}
开发者ID:secure-endpoints,项目名称:netidmgr,代码行数:49,代码来源:kherr.c
示例15: test_query_string
void test_query_string() {
void* ctx;
parse_query_string(&ctx, "width=640&height=360&video=bigbunny.ogg");
const char* width = get_parameter(ctx, "width");
const char* height = get_parameter(ctx, "height");
const char* video = get_parameter(ctx, "video");
if(!strcmp(width,"640")) {
printf("Querystring width esperado:%s - recebido:%s\n", "640", width);
}
if(!strcmp(height,"360")) {
printf("Querystring height esperado:%s - recebido:%s\n", "360", height);
}
if(!strcmp(video,"bigbunny.ogg")) {
printf("Querystring video esperado:%s - recebido:%s\n", "bigbunny.ogg", video);
}
release_context(ctx);
}
开发者ID:dayvson,项目名称:Apache-Get-Video-Thumbnail,代码行数:17,代码来源:main.c
示例16: loadfile
static int loadfile(struct sr_input *in, const char *filename)
{
struct sr_datafeed_packet packet;
struct sr_datafeed_meta meta;
struct sr_config *src;
FILE *file;
struct context *ctx;
uint64_t samplerate;
ctx = in->internal;
if ((file = fopen(filename, "r")) == NULL)
return SR_ERR;
if (!parse_header(file, ctx))
{
sr_err("VCD parsing failed");
fclose(file);
return SR_ERR;
}
/* Send header packet to the session bus. */
std_session_send_df_header(in->sdi, LOG_PREFIX);
/* Send metadata about the SR_DF_LOGIC packets to come. */
packet.type = SR_DF_META;
packet.payload = &meta;
samplerate = ctx->samplerate / ctx->downsample;
src = sr_config_new(SR_CONF_SAMPLERATE, g_variant_new_uint64(samplerate));
meta.config = g_slist_append(NULL, src);
sr_session_send(in->sdi, &packet);
sr_config_free(src);
/* Parse the contents of the VCD file */
parse_contents(file, in->sdi, ctx);
/* Send end packet to the session bus. */
packet.type = SR_DF_END;
sr_session_send(in->sdi, &packet);
fclose(file);
release_context(ctx);
in->internal = NULL;
return SR_OK;
}
开发者ID:adlerweb,项目名称:libsigrok,代码行数:46,代码来源:vcd.c
示例17: test_gzip
void test_gzip()
{
std::cout << "- Page Gzip" << std::endl;
set_context(true);
cache().clear();
TEST(request().getenv("HTTP_ACCEPT_ENCODING") == "gzip, deflate");
cache().fetch_page("test");
response().out() << "gzip";
cache().store_page("test");
TEST(str().substr(0,2)=="\x1f\x8b");
TEST(gzip_);
set_context(false);
TEST(request().getenv("HTTP_ACCEPT_ENCODING") == "");
TEST(cache_size() == 1);
TEST(cache().fetch_page("test") ==false);
response().out() << "gzip";
cache().store_page("test");
TEST(str() == "gzip");
TEST(!gzip_);
set_context(false);
TEST(cache().fetch_page("test"));
TEST(str()=="gzip");
TEST(!gzip_);
set_context(true);
TEST(cache().fetch_page("test"));
TEST(str().substr(0,2)=="\x1f\x8b");
TEST(gzip_);
set_context(false);
TEST(cache_size()==2);
cache().clear();
TEST(cache_size()==0);
release_context();
}
开发者ID:klupek,项目名称:cppcms,代码行数:39,代码来源:cache_frontend_test.cpp
示例18: test_basic
void test_basic()
{
std::cout << "- Page Basic" << std::endl;
set_context(false);
TEST(cache().has_cache());
TEST(!cache().fetch_page("test"));
response().out() << "test";
cache().add_trigger("x");
cache().store_page("test");
TEST(str()=="test");
set_context(false);
TEST(cache_size()==1);
TEST(cache().fetch_page("test"));
TEST(str()=="test");
set_context(false);
cache().rise("x");
TEST(cache_size() == 0);
TEST(!cache().fetch_page("test"));
cache().add_trigger("x");
response().out() << "test2";
cache().reset(); // reset works
cache().store_page("test",2);
TEST(str()=="test2");
set_context(false);
cache().rise("x");
TEST(cache_size() == 1);
TEST(cache().fetch_page("test"));
TEST(str() == "test2");
booster::ptime::millisleep(3000);
set_context(false);
TEST(cache().fetch_page("test")==false);
cache().clear();
release_context();
}
开发者ID:klupek,项目名称:cppcms,代码行数:37,代码来源:cache_frontend_test.cpp
示例19: CSWIFTerr
//.........这里部分代码省略.........
BIGNUM *dsa_g = NULL;
BIGNUM *dsa_key = NULL;
BIGNUM *result = NULL;
DSA_SIG *to_return = NULL;
int acquired = 0;
if((ctx = BN_CTX_new()) == NULL)
goto err;
if(!get_context(&hac))
{
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_UNIT_FAILURE);
goto err;
}
acquired = 1;
/* Prepare the params */
BN_CTX_start(ctx);
dsa_p = BN_CTX_get(ctx);
dsa_q = BN_CTX_get(ctx);
dsa_g = BN_CTX_get(ctx);
dsa_key = BN_CTX_get(ctx);
result = BN_CTX_get(ctx);
if(!result)
{
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_BN_CTX_FULL);
goto err;
}
if(!bn_wexpand(dsa_p, dsa->p->top) ||
!bn_wexpand(dsa_q, dsa->q->top) ||
!bn_wexpand(dsa_g, dsa->g->top) ||
!bn_wexpand(dsa_key, dsa->priv_key->top) ||
!bn_wexpand(result, dsa->p->top))
{
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_BN_EXPAND_FAIL);
goto err;
}
sw_param.type = SW_ALG_DSA;
sw_param.up.dsa.p.nbytes = BN_bn2bin(dsa->p,
(unsigned char *)dsa_p->d);
sw_param.up.dsa.p.value = (unsigned char *)dsa_p->d;
sw_param.up.dsa.q.nbytes = BN_bn2bin(dsa->q,
(unsigned char *)dsa_q->d);
sw_param.up.dsa.q.value = (unsigned char *)dsa_q->d;
sw_param.up.dsa.g.nbytes = BN_bn2bin(dsa->g,
(unsigned char *)dsa_g->d);
sw_param.up.dsa.g.value = (unsigned char *)dsa_g->d;
sw_param.up.dsa.key.nbytes = BN_bn2bin(dsa->priv_key,
(unsigned char *)dsa_key->d);
sw_param.up.dsa.key.value = (unsigned char *)dsa_key->d;
/* Attach the key params */
sw_status = p_CSwift_AttachKeyParam(hac, &sw_param);
switch(sw_status)
{
case SW_OK:
break;
case SW_ERR_INPUT_SIZE:
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_BAD_KEY_SIZE);
goto err;
default:
{
char tmpbuf[DECIMAL_SIZE(sw_status)+1];
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", sw_status);
ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf);
}
goto err;
}
/* Prepare the argument and response */
arg.nbytes = dlen;
arg.value = (unsigned char *)dgst;
res.nbytes = BN_num_bytes(dsa->p);
memset(result->d, 0, res.nbytes);
res.value = (unsigned char *)result->d;
/* Perform the operation */
sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_DSS_SIGN, &arg, 1,
&res, 1);
if(sw_status != SW_OK)
{
char tmpbuf[DECIMAL_SIZE(sw_status)+1];
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", sw_status);
ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf);
goto err;
}
/* Convert the response */
ptr = (unsigned char *)result->d;
if((to_return = DSA_SIG_new()) == NULL)
goto err;
to_return->r = BN_bin2bn((unsigned char *)result->d, 20, NULL);
to_return->s = BN_bin2bn((unsigned char *)result->d + 20, 20, NULL);
err:
if(acquired)
release_context(hac);
if(ctx)
{
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
return to_return;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:101,代码来源:e_cswift.c
示例20: release_context
ns_usb_context::~ns_usb_context(){
release_context();
}
开发者ID:Carsten2,项目名称:lifespan,代码行数:3,代码来源:ns_usb.cpp
注:本文中的release_context函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论