本文整理汇总了C++中PL_DestroyOptState函数的典型用法代码示例。如果您正苦于以下问题:C++ PL_DestroyOptState函数的具体用法?C++ PL_DestroyOptState怎么用?C++ PL_DestroyOptState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PL_DestroyOptState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
int count, errnum;
/*
* -d debug mode
*/
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);
count = sizeof(errcodes)/sizeof(errcodes[0]);
printf("\nNumber of error codes = %d\n\n",count);
for (errnum = 0; errnum < count; errnum++) {
printf("%-40s = %d\n",errcodes[errnum].errname,
errcodes[errnum].errcode);
}
return 0;
}
示例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: 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;
}
示例4: main
PRIntn main(PRIntn argc, char *argv[])
{
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "dhp:P:a:A:i:s:t:");
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
if (PL_OPT_BAD == os) continue;
switch (opt->option)
{
case 'a': /* arena Min size */
arenaMin = atol( opt->value );
break;
case 'A': /* arena Max size */
arenaMax = atol( opt->value );
break;
case 'p': /* pool Min size */
poolMin = atol( opt->value );
break;
case 'P': /* pool Max size */
poolMax = atol( opt->value );
break;
case 'i': /* Iterations in stress tests */
stressIterations = atol( opt->value );
break;
case 's': /* storage to get per iteration */
maxAlloc = atol( opt->value );
break;
case 't': /* Number of stress threads to create */
stressThreads = atol( opt->value );
break;
case 'd': /* debug mode */
debug_mode = 1;
break;
case 'h': /* help */
default:
Help();
} /* end switch() */
} /* end while() */
PL_DestroyOptState(opt);
srand( (unsigned)time( NULL ) ); /* seed random number generator */
tLM = PR_NewLogModule("testcase");
#if 0
ArenaAllocate();
ArenaGrow();
#endif
MarkAndRelease();
Stress();
return(EvaluateResults());
} /* end main() */
示例5: main
int main(int argc, char **argv)
{
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "dh");
PRFileDesc* fd;
PRErrorCode err;
/* parse command line options */
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) {
if (PL_OPT_BAD == os) continue;
switch (opt->option) {
case 'd': /* debug mode */
debug_mode = PR_TRUE;
break;
case 'h':
default:
Help();
return 2;
}
}
PL_DestroyOptState(opt);
lm = PR_NewLogModule( "testcase" );
(void) PR_MkDir( DIRNAME, 0777);
fd = PR_Open( DIRNAME FILENAME, PR_CREATE_FILE|PR_RDWR, 0666);
if (fd == 0) {
PRErrorCode err = PR_GetError();
fprintf(stderr, "create file fails: %d: %s\n", err,
PR_ErrorToString(err, PR_LANGUAGE_I_DEFAULT));
failed_already = PR_TRUE;
goto Finished;
}
PR_Close(fd);
if (PR_RmDir( DIRNAME ) == PR_SUCCESS) {
fprintf(stderr, "remove directory succeeds\n");
failed_already = PR_TRUE;
goto Finished;
}
err = PR_GetError();
fprintf(stderr, "remove directory fails with: %d: %s\n", err,
PR_ErrorToString(err, PR_LANGUAGE_I_DEFAULT));
(void) PR_Delete( DIRNAME FILENAME);
(void) PR_RmDir( DIRNAME );
return 0;
Finished:
if ( debug_mode ) printf("%s\n", ( failed_already ) ? "FAILED" : "PASS" );
return( (failed_already)? 1 : 0 );
} /* --- end main() */
示例6: RealMain
static PRIntn PR_CALLBACK RealMain(PRIntn argc, char **argv)
{
Overlay_i si;
Overlay_u ui;
PLOptStatus os;
PRBool bsi = PR_FALSE, bui = PR_FALSE;
PLOptState *opt = PL_CreateOptState(argc, argv, "hi:u:");
err = PR_GetSpecialFD(PR_StandardError);
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
if (PL_OPT_BAD == os) continue;
switch (opt->option)
{
case 'i': /* signed integer */
si.i = (PRInt32)atoi(opt->value);
bsi = PR_TRUE;
break;
case 'u': /* unsigned */
ui.i = (PRUint32)atoi(opt->value);
bui = PR_TRUE;
break;
case 'h': /* user wants some guidance */
default:
Help(); /* so give him an earful */
return 2; /* but not a lot else */
}
}
PL_DestroyOptState(opt);
#if defined(HAVE_LONG_LONG)
PR_fprintf(err, "We have long long\n");
#else
PR_fprintf(err, "We don't have long long\n");
#endif
if (bsi)
{
PR_fprintf(err, "Converting %ld: ", si.i);
LL_I2L(si.l, si.i);
PR_fprintf(err, "%lld\n", si.l);
}
if (bui)
{
PR_fprintf(err, "Converting %lu: ", ui.i);
LL_I2L(ui.l, ui.i);
PR_fprintf(err, "%llu\n", ui.l);
}
return 0;
} /* main */
示例7: RealMain
static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv )
{
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
All of the printfs associated with this test has been handled with a if (debug_mode)
test.
Usage: test_name -d
*/
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_mode = 1;
break;
default:
break;
}
}
PL_DestroyOptState(opt);
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
#ifdef XP_MAC
SetupMacPrintfLog("joinuk.log");
#endif
/* main test */
if (debug_mode) printf("User-Kernel test\n");
runTest(PR_LOCAL_THREAD, PR_GLOBAL_THREAD);
if(failed_already)
{
printf("FAIL\n");
return 1;
} else
{
printf("PASS\n");
return 0;
}
}
示例8: main
int main(int argc, char **argv)
{
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
All of the printfs associated with this test has been handled with a if (debug_mode)
test.
Usage: test_name -d
*/
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_mode = 1;
break;
default:
break;
}
}
PL_DestroyOptState(opt);
/* main test */
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
if (argc > 2) {
count = atoi(argv[2]);
} else {
count = DEFAULT_COUNT;
}
#if defined(XP_UNIX)
Measure(NativeSelectTest, "time to call 1 element select()");
#endif
Measure(EmptyPRSelect, "time to call Empty PR_select()");
Measure(EmptyNativeSelect, "time to call Empty select()");
Measure(PRSelectTest, "time to call 1 element PR_select()");
if (!debug_mode) Test_Result (NOSTATUS);
PR_Cleanup();
}
示例9: main
int main(int argc, char **argv)
{
PRInt32 num_threads;
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
All of the printfs associated with this test has been handled with a if (debug_mode)
test.
Usage: test_name -d
*/
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_mode = 1;
break;
default:
break;
}
}
PL_DestroyOptState(opt);
/* main test */
if (argc > 2)
num_threads = atoi(argv[2]);
else
num_threads = NUM_THREADS;
PR_Init(PR_USER_THREAD, PR_PRIORITY_LOW, 0);
PR_STDIO_INIT();
if (debug_mode) printf("kernel level test\n");
thread_test(PR_GLOBAL_THREAD, num_threads);
PR_Cleanup();
if(failed_already)
return 1;
else
return 0;
}
示例10: main
int main(int argc, char **argv)
{
{
/*
** Get command line options
*/
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "hdv");
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
if (PL_OPT_BAD == os) continue;
switch (opt->option)
{
case 'd': /* debug */
debug = 1;
msgLevel = PR_LOG_ERROR;
break;
case 'v': /* verbose mode */
msgLevel = PR_LOG_DEBUG;
break;
case 'h': /* help message */
Help();
break;
default:
break;
}
}
PL_DestroyOptState(opt);
}
lm = PR_NewLogModule("Test"); /* Initialize logging */
for ( i = 0; i < optRandCount ; i++ ) {
memset( buf, 0, bufSize );
rSize = PR_GetRandomNoise( buf, bufSize );
if (!rSize) {
fprintf(stderr, "Not implemented\n" );
failed_already = PR_TRUE;
break;
}
if (debug) PrintRand( buf, rSize );
}
if (debug) printf("%s\n", (failed_already)? "FAIL" : "PASS");
return( (failed_already == PR_TRUE )? 1 : 0 );
} /* main() */
示例11: main
int main(int argc, char **argv)
{
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
All of the printfs associated with this test has been handled with a if (debug_mode)
test.
Usage: test_name -d
*/
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_mode = 1;
break;
default:
break;
}
}
PL_DestroyOptState(opt);
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
if (argc > 1) {
count = atoi(argv[1]);
} else {
count = DEFAULT_COUNT;
}
ftime_init();
Measure(timeTime, "time to get time with time()");
Measure(timeGethrtime, "time to get time with gethrtime()");
Measure(timeGettimeofday, "time to get time with gettimeofday()");
Measure(timePRTime32, "time to get time with PR_Time() (32bit)");
Measure(timePRTime64, "time to get time with PR_Time() (64bit)");
PR_Cleanup();
return 0;
}
示例12: RealMain
static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv )
{
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "dhlmc");
PRBool locks = PR_FALSE, monitors = PR_FALSE, cmonitors = PR_FALSE;
err = PR_GetSpecialFD(PR_StandardError);
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
if (PL_OPT_BAD == os) continue;
switch (opt->option)
{
case 'd': /* debug mode (noop) */
break;
case 'l': /* locks */
locks = PR_TRUE;
break;
case 'm': /* monitors */
monitors = PR_TRUE;
break;
case 'c': /* cached monitors */
cmonitors = PR_TRUE;
break;
case 'h': /* needs guidance */
default:
Help();
return 2;
}
}
PL_DestroyOptState(opt);
ml = PR_NewLock();
if (locks) T1Lock();
if (monitors) T1Mon();
if (cmonitors) T1CMon();
PR_DestroyLock(ml);
PR_fprintf(err, "Done!\n");
return 0;
} /* main */
示例13: main
int main(int argc, char **argv)
{
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "dl:r:");
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
if (PL_OPT_BAD == os) continue;
switch (opt->option)
{
case 'd': /* debug mode */
debug = PR_TRUE;
break;
default:
break;
}
}
PL_DestroyOptState(opt);
PR_STDIO_INIT();
return PR_Initialize(Tpd, argc, argv, 0);
} /* main */
示例14: RealMain
static PRIntn PR_CALLBACK RealMain(int argc, char **argv)
{
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
All of the printfs associated with this test has been handled with a if (debug_mode)
test.
Usage: test_name -d
*/
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_mode = 1;
break;
default:
break;
}
}
PL_DestroyOptState(opt);
/* main test */
printf("User-User test\n");
runTest(PR_LOCAL_THREAD, PR_LOCAL_THREAD);
printf("User-Kernel test\n");
runTest(PR_LOCAL_THREAD, PR_GLOBAL_THREAD);
printf("Kernel-User test\n");
runTest(PR_GLOBAL_THREAD, PR_LOCAL_THREAD);
printf("Kernel-Kernel test\n");
runTest(PR_GLOBAL_THREAD, PR_GLOBAL_THREAD);
printf("Join with unjoinable thread\n");
joinWithUnjoinable();
printf("PASSED\n");
return 0;
}
示例15: main
int main(int argc, char **argv)
{
/*
* -d debug mode
*/
PLOptStatus os;
PLOptState *opt;
program_name = argv[0];
opt = PL_CreateOptState(argc, argv, "dp:");
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;
case 'p':
server_port = atoi(opt->value);
break;
default:
break;
}
}
PL_DestroyOptState(opt);
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
PR_SetConcurrency(4);
TCP_Socket_Client_Server_Test();
PR_Cleanup();
if (failed_already)
return 1;
else
return 0;
}