本文整理汇总了C++中release_context函数的典型用法代码示例。如果您正苦于以下问题:C++ release_context函数的具体用法?C++ release_context怎么用?C++ release_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了release_context函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例10: multiple
void multiple()
{
calls ++;
binder call;
call.context = release_context();
call.counter = 10000;
call(cppcms::http::context::operation_completed);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}
}
}
示例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);
}