本文整理汇总了C++中PR_Cleanup函数的典型用法代码示例。如果您正苦于以下问题:C++ PR_Cleanup函数的具体用法?C++ PR_Cleanup怎么用?C++ PR_Cleanup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PR_Cleanup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main_free
/*
* This is the main global destructor for the app. Call this after
* _all_ libcurl usage is done.
*/
static void main_free(struct GlobalConfig *config)
{
/* Cleanup the easy handle */
curl_easy_cleanup(config->easy);
config->easy = NULL;
/* Main cleanup */
curl_global_cleanup();
convert_cleanup();
metalink_cleanup();
#ifdef USE_NSS
if(PR_Initialized()) {
/* prevent valgrind from reporting still reachable mem from NSRP arenas */
PL_ArenaFinish();
/* prevent valgrind from reporting possibly lost memory (fd cache, ...) */
PR_Cleanup();
}
#endif
free_config_fields(config);
/* Free the config structures */
config_free(config->last);
config->first = NULL;
config->last = NULL;
}
示例2: main
int main (int argc, char **argv)
{
static PRIntervalTime thread_start_time;
static PRThread *housekeeping_tid = NULL;
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "d");
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
if (PL_OPT_BAD == os) continue;
switch (opt->option)
{
case 'd': /* debug mode */
_debug_on = 1;
break;
default:
break;
}
}
PL_DestroyOptState(opt);
if (( housekeeping_tid =
PR_CreateThread (PR_USER_THREAD, housecleaning, (void*)&thread_start_time,
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0))
== NULL ) {
fprintf(stderr,
"simple_test: Error - PR_CreateThread failed: (%ld, %ld)\n",
PR_GetError(), PR_GetOSError());
exit( 1 );
}
PR_Cleanup();
return(0);
}
示例3: qdevice_model_net_destroy
int
qdevice_model_net_destroy(struct qdevice_instance *instance)
{
struct qdevice_net_instance *net_instance;
net_instance = instance->model_data;
qdevice_log(LOG_DEBUG, "Destroying algorithm");
qdevice_net_algorithm_destroy(net_instance);
qdevice_log(LOG_DEBUG, "Destroying qdevice_net_instance");
qdevice_net_instance_destroy(net_instance);
qdevice_log(LOG_DEBUG, "Shutting down NSS");
SSL_ClearSessionCache();
if (NSS_Shutdown() != SECSuccess) {
qdevice_log_nss(LOG_WARNING, "Can't shutdown NSS");
}
if (PR_Cleanup() != PR_SUCCESS) {
qdevice_log_nss(LOG_WARNING, "Can't shutdown NSPR");
}
free(net_instance);
return (0);
}
示例4: main
int main(int argc, char **argv)
{
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
if (argc > 1) {
count = atoi(argv[1]);
} else {
count = 5;
}
printf("\n\n%20s%30s\n\n"," ","Suspend_Resume Test");
CreateThreadsUU();
CreateThreadsUK();
CreateThreadsKU();
CreateThreadsKK();
PR_SetConcurrency(2);
printf("\n%20s%30s\n\n"," ","Added 2nd CPU\n");
CreateThreadsUK();
CreateThreadsKK();
CreateThreadsUU();
CreateThreadsKU();
PR_Cleanup();
return 0;
}
示例5: crypto_init
gboolean
crypto_init (GError **error)
{
SECStatus ret;
if (initialized)
return TRUE;
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 1);
ret = NSS_NoDB_Init (NULL);
if (ret != SECSuccess) {
g_set_error (error, NM_CRYPTO_ERROR,
NM_CRYPTO_ERROR_FAILED,
_("Failed to initialize the crypto engine: %d."),
PR_GetError ());
PR_Cleanup ();
return FALSE;
}
SEC_PKCS12EnableCipher(PKCS12_RC4_40, 1);
SEC_PKCS12EnableCipher(PKCS12_RC4_128, 1);
SEC_PKCS12EnableCipher(PKCS12_RC2_CBC_40, 1);
SEC_PKCS12EnableCipher(PKCS12_RC2_CBC_128, 1);
SEC_PKCS12EnableCipher(PKCS12_DES_56, 1);
SEC_PKCS12EnableCipher(PKCS12_DES_EDE3_168, 1);
SEC_PKCS12SetPreferredCipher(PKCS12_DES_EDE3_168, 1);
initialized = TRUE;
return TRUE;
}
示例6: main
int main(int argc, char **argv) {
int rv;
debug_mode = 1;
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_SetThreadGCAble();
#ifdef XP_MAC
SetupMacPrintfLog("thrashgc.log");
debug_mode = 1;
#endif
PR_InitGC(0, 0, 0, PR_GLOBAL_THREAD);
PR_STDIO_INIT();
stderrLock = PR_NewLock();
tix1 = PR_RegisterType(&type1);
tix2 = PR_RegisterType(&type2);
tix3 = PR_RegisterType(&type3);
gcInfo = PR_GetGCInfo();
rv = padMain(argc, argv);
printf("PASS\n");
PR_Cleanup();
return rv;
}
示例7: lsw_nss_shutdown
void lsw_nss_shutdown(void)
{
NSS_Shutdown();
if (!(flags & LSW_NSS_SKIP_PR_CLEANUP)) {
PR_Cleanup();
}
}
示例8: runCmd
static
int runCmd(mainTestFn fnPointer,
int argc,
char **argv,
char *dbPath)
{
int retStat = 0;
/* Initialize NSPR and NSS. */
PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
/* if using databases, use NSS_Init and not NSS_NoDB_Init */
if (dbPath && PORT_Strlen(dbPath) != 0) {
if (NSS_Init(dbPath) != SECSuccess)
return SECFailure;
} else {
if (NSS_NoDB_Init(NULL) != 0)
return SECFailure;
}
retStat = fnPointer(argc, argv);
if (NSS_Shutdown() != SECSuccess) {
exit(1);
}
PR_Cleanup();
return retStat;
}
示例9: nssCleanup
void
nssCleanup (void)
{
/* Shutdown NSS and exit NSPR gracefully. */
NSS_Shutdown ();
PR_Cleanup ();
}
示例10: crypto_global_finish
void
crypto_global_finish(void)
{
NSS_Shutdown();
PL_ArenaFinish();
PR_Cleanup();
}
示例11: ssl_nss_uninit
static void
ssl_nss_uninit(void)
{
NSS_Shutdown();
PR_Cleanup();
_nss_methods = NULL;
}
示例12: crypto_deinit
void
crypto_deinit (void)
{
if (initialized) {
NSS_Shutdown ();
PR_Cleanup ();
}
}
示例13: main
int
main(int argc, char **argv)
{
char * progName = NULL;
SECStatus secStatus;
PLOptState *optstate;
PLOptStatus status;
/* Call the NSPR initialization routines */
PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
progName = PL_strdup(argv[0]);
hostName = NULL;
optstate = PL_CreateOptState(argc, argv, "d:h:i:o:p:t:");
while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK)
{
switch(optstate->option)
{
case 'd' : certDir = PL_strdup(optstate->value); break;
case 'h' : hostName = PL_strdup(optstate->value); break;
case 'i' : infileName = PL_strdup(optstate->value); break;
case 'o' : outfileName = PL_strdup(optstate->value); break;
case 'p' : port = PORT_Atoi(optstate->value); break;
case 't' : trustNewServer_p = PL_strdup(optstate->value); break;
case '?' :
default : Usage(progName);
}
}
if (port == 0 || hostName == NULL || infileName == NULL || outfileName == NULL || certDir == NULL)
Usage(progName);
#if 0 /* no client authentication */
/* Set our password function callback. */
PK11_SetPasswordFunc(myPasswd);
#endif
/* Initialize the NSS libraries. */
secStatus = NSS_InitReadWrite(certDir);
if (secStatus != SECSuccess)
{
/* Try it again, readonly. */
secStatus = NSS_Init(certDir);
if (secStatus != SECSuccess)
exitErr("Error initializing NSS", GENERAL_ERROR);
}
/* All cipher suites except RSA_NULL_MD5 are enabled by Domestic Policy. */
NSS_SetDomesticPolicy();
client_main(port);
NSS_Shutdown();
PR_Cleanup();
return 0;
}
示例14: PR_IMPLEMENT
PR_IMPLEMENT(PRIntn) PR_Initialize(
PRPrimordialFn prmain, PRIntn argc, char **argv, PRUintn maxPTDs)
{
PRIntn rv;
_PR_ImplicitInitialization();
rv = prmain(argc, argv);
PR_Cleanup();
return rv;
} /* PR_Initialize */
示例15: main
int main(int argc, char **argv)
{
PRInt32 initial_threads = DEFAULT_INITIAL_THREADS;
PRInt32 max_threads = DEFAULT_MAX_THREADS;
PRInt32 stacksize = DEFAULT_STACKSIZE;
PRThreadPool *tp = NULL;
PRStatus rv;
PRJob *jobp;
/*
* -d debug mode
*/
PLOptStatus os;
PLOptState *opt;
program_name = argv[0];
opt = PL_CreateOptState(argc, argv, "d");
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
if (PL_OPT_BAD == os) continue;
switch (opt->option)
{
case 'd': /* debug mode */
_debug_on = 1;
break;
default:
break;
}
}
PL_DestroyOptState(opt);
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
PR_SetConcurrency(4);
tp = PR_CreateThreadPool(initial_threads, max_threads, stacksize);
if (NULL == tp) {
printf("PR_CreateThreadPool failed\n");
failed_already=1;
goto done;
}
jobp = PR_QueueJob(tp, TCP_Server, tp, PR_TRUE);
rv = PR_JoinJob(jobp);
PR_ASSERT(PR_SUCCESS == rv);
DPRINTF(("%s: calling PR_JoinThreadPool\n", program_name));
rv = PR_JoinThreadPool(tp);
PR_ASSERT(PR_SUCCESS == rv);
DPRINTF(("%s: returning from PR_JoinThreadPool\n", program_name));
done:
PR_Cleanup();
if (failed_already) return 1;
else return 0;
}