当前位置: 首页>>代码示例>>C++>>正文


C++ START函数代码示例

本文整理汇总了C++中START函数的典型用法代码示例。如果您正苦于以下问题:C++ START函数的具体用法?C++ START怎么用?C++ START使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了START函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main ()
{

	PROCESS_ATTRIBUTE_TYPE tattr;
	RETURN_CODE_TYPE ret;

	printf("	part3 - Main thread\n");
	tattr.PERIOD = 400;
	tattr.BASE_PRIORITY = 8;
	tattr.ENTRY_POINT = thr3_1_job;
	CREATE_PROCESS (&(tattr), &(arinc_threads[1]), &(ret));

	tattr.PERIOD = 400;
	tattr.BASE_PRIORITY = 8;
	tattr.ENTRY_POINT = thr3_2_job;
	CREATE_PROCESS (&(tattr), &(arinc_threads[2]), &(ret));


	START (arinc_threads[2],&(ret));

	SET_PARTITION_MODE (NORMAL, &(ret));
	return 0;
}
开发者ID:t-crest,项目名称:ospat,代码行数:23,代码来源:main.c

示例2: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "util_poolset_foreach");

	out_init(LOG_PREFIX, LOG_LEVEL_VAR, LOG_FILE_VAR,
			MAJOR_VERSION, MINOR_VERSION);
	util_init();

	if (argc < 2)
		FATAL("usage: %s file...",
			argv[0]);

	for (int i = 1; i < argc; i++) {
		char *fname = argv[i];
		int ret = util_poolset_foreach_part(fname, cb, fname);

		OUT("util_poolset_foreach_part(%s): %d", fname, ret);
	}
	out_fini();

	DONE(NULL);
}
开发者ID:Neuvenen,项目名称:nvml,代码行数:23,代码来源:util_poolset_foreach.c

示例3: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_heap_state");

	if (argc != 2)
		UT_FATAL("usage: %s file-name", argv[0]);

	const char *path = argv[1];

	for (int i = 0; i < ALLOC_SIZE; i++)
		buf[i] = rand() % 256;

	PMEMobjpool *pop = NULL;

	if ((pop = pmemobj_create(path, LAYOUT_NAME,
			0, S_IWUSR | S_IRUSR)) == NULL)
		UT_FATAL("!pmemobj_create: %s", path);

	pmemobj_root(pop, ROOT_SIZE); /* just to trigger allocation */

	pmemobj_close(pop);

	pop = pmemobj_open(path, LAYOUT_NAME);
	UT_ASSERTne(pop, NULL);

	for (int i = 0; i < ALLOCS; ++i) {
		PMEMoid oid;
		pmemobj_alloc(pop, &oid, ALLOC_SIZE, 0,
				test_constructor, NULL);
		UT_OUT("%d %lu", i, oid.off);
	}

	pmemobj_close(pop);

	DONE(NULL);
}
开发者ID:ChandKV,项目名称:nvml,代码行数:37,代码来源:obj_heap_state.c

示例4: main

int
main(int argc, char *argv[])
{
	VMEM *vmp;
	size_t i;

	START(argc, argv, "vmem_create_in_region");

	if (argc > 1)
		FATAL("usage: %s", argv[0]);

	/* allocate memory for function vmem_create_in_region() */
	void *mem_pool = MMAP(NULL, VMEM_MIN_POOL, PROT_READ|PROT_WRITE,
					MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);

	vmp = vmem_create_in_region(mem_pool, VMEM_MIN_POOL);

	if (vmp == NULL)
		FATAL("!vmem_create_in_region");

	for (i = 0; i < TEST_ALLOCATIONS; ++i) {
		allocs[i] = vmem_malloc(vmp, sizeof (int));

		ASSERTne(allocs[i], NULL);

		/* check that pointer came from mem_pool */
		ASSERTrange(allocs[i], mem_pool, VMEM_MIN_POOL);
	}

	for (i = 0; i < TEST_ALLOCATIONS; ++i) {
		vmem_free(vmp, allocs[i]);
	}

	vmem_delete(vmp);

	DONE(NULL);
}
开发者ID:KaiZhang666,项目名称:nvml,代码行数:37,代码来源:vmem_create_in_region.c

示例5: main

int
main(int argc, char *argv[])
{
    const int test_value = 12345;
    size_t size;
    int *ptr[SIZE];
    int i = 0;
    size_t sum_alloc = 0;

    START(argc, argv, "vmmalloc_malloc");

    /* test with multiple size of allocations from 4MB to sizeof (int) */
    for (size = MAX_SIZE; size > MIN_SIZE; size /= 2) {
        ptr[i] = malloc(size);

        if (ptr[i] == NULL)
            continue;

        *ptr[i] = test_value;
        ASSERTeq(*ptr[i], test_value);

        sum_alloc += size;
        i++;
    }

    /* at least one allocation for each size must succeed */
    ASSERTeq(size, MIN_SIZE);

    /* allocate more than half of pool size */
    ASSERT(sum_alloc * 2 > VMEM_MIN_POOL);

    while (i > 0)
        free(ptr[--i]);

    DONE(NULL);
}
开发者ID:andreas-bluemle,项目名称:nvml,代码行数:36,代码来源:vmmalloc_malloc.c

示例6: main

/* Entry point */
void main(void){
	RETURN_CODE_TYPE retCode;
	PROCESS_ID_TYPE procMainIdMT;
	char sal_code[MAX_CAD];

	CREATE_PROCESS (&(processTable [0]),       /* process attribute */
                    &procMainIdMT,             /* process Id */
                    &retCode);
    CHECK_CODE(": CREATE_PROCESS Process Master Test", retCode, sal_code);
    printf("%s\n", sal_code);


	/* Start main process ... */
	START(procMainIdMT, &retCode);
	CHECK_CODE(": START Process Master Test", retCode, sal_code);
    printf("%s\n", sal_code);


	/* To set the partition in a Normal State */
	SET_PARTITION_MODE(NORMAL, &retCode);
	CHECK_CODE(": SET_PARTITION_MODE ", retCode, sal_code);
    printf("%s\n", sal_code);

}
开发者ID:Kvasshtain,项目名称:uos-embedded,代码行数:25,代码来源:app12.c

示例7: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_cpp_shared_mutex");

	if (argc != 2)
		UT_FATAL("usage: %s file-name", argv[0]);

	const char *path = argv[1];

	nvobj::pool<root> pop;

	try {
		pop = nvobj::pool<root>::create(path, LAYOUT, PMEMOBJ_MIN_POOL,
						S_IWUSR | S_IRUSR);
	} catch (nvml::pool_error &pe) {
		UT_FATAL("!pool::create: %s %s", pe.what(), path);
	}

	int expected = num_threads * num_ops * 2;
	mutex_test(pop, writer, reader);
	UT_ASSERTeq(pop.get_root()->counter, expected);

	/* trylocks are not tested as exhaustively */
	expected -= num_threads * 2;
	mutex_test(pop, writer_trylock, reader_trylock);
	UT_ASSERTeq(pop.get_root()->counter, expected);

	/* pmemcheck related persist */
	pmemobj_persist(pop.get_handle(), &(pop.get_root()->counter),
			sizeof(pop.get_root()->counter));

	pop.close();

	DONE(NULL);
}
开发者ID:ChandKV,项目名称:nvml,代码行数:36,代码来源:obj_cpp_shared_mutex.cpp

示例8: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_cpp_map");

	if (argc != 3 || strchr("co", argv[1][0]) == nullptr)
		UT_FATAL("usage: %s <c,o> file-name", argv[0]);

	const char *path = argv[2];

	nvobj::pool<root> pop;
	bool open = (argv[1][0] == 'o');

	try {
		if (open) {
			pop = nvobj::pool<root>::open(path, LAYOUT);

		} else {
			pop = nvobj::pool<root>::create(path, LAYOUT,
							PMEMOBJ_MIN_POOL * 2,
							S_IWUSR | S_IRUSR);
			nvobj::transaction::manual tx(pop);
			pop.get_root()->cons =
				nvobj::make_persistent<containers>(pop);
			nvobj::transaction::commit();
		}
	} catch (nvml::pool_error &pe) {
		UT_FATAL("!pool::create: %s %s", pe.what(), path);
	}

	test_map(pop, open);

	pop.close();

	DONE(nullptr);
}
开发者ID:tomaszkapela,项目名称:nvml,代码行数:36,代码来源:obj_cpp_map.cpp

示例9: main

int
main(int argc, char *argv[])
{
	void *ptr;

	START(argc, argv, "vmmalloc_malloc_hooks");

	ptr = malloc(4321);
	free(ptr);

	ptr = calloc(1, 4321);
	free(ptr);

	ptr = realloc(NULL, 4321);
	free(ptr);

	ptr = memalign(16, 4321);
	free(ptr);

	OUT("malloc %d realloc %d memalign %d free %d",
			malloc_cnt, realloc_cnt, memalign_cnt, free_cnt);

	DONE(NULL);
}
开发者ID:KaiZhang666,项目名称:nvml,代码行数:24,代码来源:vmmalloc_malloc_hooks.c

示例10: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "util_file_open");

	if (argc < 3)
		UT_FATAL("usage: %s minlen path...", argv[0]);

	char *fname;
	size_t minsize = strtoul(argv[1], &fname, 0);

	for (int arg = 2; arg < argc; arg++) {
		size_t size = 0;
		int fd = util_file_open(argv[arg], &size, minsize, O_RDWR);
		if (fd == -1)
			UT_OUT("!%s: util_file_open", argv[arg]);
		else {
			UT_OUT("%s: open, len %zu", argv[arg], size);
			close(fd);
		}
	}

	DONE(NULL);
}
开发者ID:JLLLinn,项目名称:nvml,代码行数:24,代码来源:util_file_open.c

示例11: HTNewsNode_print

/*
**	Output an element in HTML
**	Returns YES if OK, else NO
*/
PRIVATE BOOL HTNewsNode_print (HTNewsDir * dir, HTNewsNode * node)
{
    if (node && node->show) {
	HTStructured *target = dir->target;
	char  * escaped;
    
	HTNewsDir_addLevelTags (dir, node->refLevel);  /* Added by MP. */
	START(HTML_LI);

	/* Start the anchor and put the subject as anchor text */
	/*  Changed by MP to allow nodes without names */
	if (!node->fake && node->name && node->subject)  {
	    escaped = HTEscape(node->name, URL_XPALPHAS);
	    HTStartAnchor(target, NULL, escaped);
	}
	if (node->subject) PUTS(node->subject);
	if (!node->fake && node->name && node->subject) {
	    END(HTML_A);
	    HT_FREE(escaped);
	}

	/* From field */
	if (node->from)  {
	    PUTS (" by ");  /* Changed by MP. */
	    PUTS(node->from);
	}

	/*  In group listing, put number of groups in the set; added by MP. */
	if (node->name && strrchr(node->name, '*')) {
	    char buf[16];
	    sprintf (buf, " (%d groups)", node->refChildren);
	    PUTS (buf);
	}
    }
    return YES;
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:40,代码来源:HTNDir.c

示例12: do_pppm

real do_pppm(FILE *log,       bool bVerbose,
	     rvec x[],        rvec f[],
	     real charge[],   rvec box,
	     real phi[],      t_commrec *cr,
	     t_nsborder *nsb, t_nrnb *nrnb)
{
  real    ener;
  int     start,nr;
  
  start = START(nsb);
  nr   = HOMENR(nsb);
  
  /* Make the grid empty */
  clear_fftgrid(grid);
  
  /* First step: spreading the charges over the grid. */
  spread_q(log,bVerbose,start,nr,x,charge,box,grid,nrnb);
  
  /* In the parallel code we have to sum the grids from neighbouring nodes */
  if (PAR(cr))
    sum_qgrid(cr,nsb,grid,TRUE);
  
  /* Second step: solving the poisson equation in Fourier space */
  solve_pppm(log,cr,grid,ghat,box,bVerbose,nrnb);
  
  /* In the parallel code we have to sum once again... */
  if (PAR(cr))
    sum_qgrid(cr,nsb,grid,FALSE);
  
  /* Third and last step: gather the forces, energies and potential
   * from the grid.
   */
  ener=gather_f(log,bVerbose,start,nr,x,f,charge,box,phi,grid,beta,nrnb);
  
  return ener;
}
开发者ID:Chadi-akel,项目名称:cere,代码行数:36,代码来源:pppm.c

示例13: main

int
main(int argc, char *argv[])
{
	START(argc, argv, "out_err");

	/* Execute test */
	out_init(LOG_PREFIX, LOG_LEVEL_VAR, LOG_FILE_VAR,
			MAJOR_VERSION, MINOR_VERSION);

	errno = 0;
	ERR("ERR #%d", 1);
	UT_OUT("%s", out_get_errormsg());

	errno = 0;
	ERR("!ERR #%d", 2);
	UT_OUT("%s", out_get_errormsg());

	errno = EINVAL;
	ERR("!ERR #%d", 3);
	UT_OUT("%s", out_get_errormsg());

	errno = EBADF;
	out_err(__FILE__, 100, __func__,
		"ERR1: %s:%d", strerror(errno), 1234);
	UT_OUT("%s", out_get_errormsg());

	errno = EBADF;
	out_err(NULL, 0, NULL,
		"ERR2: %s:%d", strerror(errno), 1234);
	UT_OUT("%s", out_get_errormsg());

	/* Cleanup */
	out_fini();

	DONE(NULL);
}
开发者ID:AmesianX,项目名称:nvml,代码行数:36,代码来源:out_err.c

示例14: Process3

/* -----------------------------------------------------------------------------------*/
void Process3(void){
	struct stop_error_type c_s;
	APEX_BYTE data[MAX_LENGTH];
	char sal_code[MAX_CAD];
	PROCESS_ID_TYPE procMainId2;
	RETURN_CODE_TYPE retCode;
	BLACKBOARD_ID_TYPE bbId;

	printf("Process 3 starts ... \n");

	strcpy(data, "OK");

	/* To get the procMainId2 value */
	GET_PROCESS_ID("tProc2", &procMainId2, &retCode);
	CHECK_CODE(": GET_PROCESS_ID Process 2", retCode, sal_code);
    printf("%s\n", sal_code);

	/* To check stop process 2 */
	c_s = check_stop(procMainId2, NO_ERROR);

	GET_BLACKBOARD_ID(BLACKBOARD_NAME_0, &bbId, &retCode);
	CHECK_CODE(": GET_BLACKBOARD_ID_0 by Process3", retCode, sal_code);
	printf("%s\n", sal_code);

	DISPLAY_BLACKBOARD (bbId, data, 3, &retCode);
	CHECK_CODE(": DISPLAY_BLACKBOARD B1 in Process 3", retCode, sal_code);
    printf("%s\n", sal_code);

	START(procMainId2, &retCode);
	CHECK_CODE(": START Process 2", retCode, sal_code);
    printf("%s\n", sal_code);

	show_results(c_s);

    STOP_SELF ();
}
开发者ID:Kvasshtain,项目名称:uos-embedded,代码行数:37,代码来源:app10.c

示例15: namei_lookup

int 
namei_lookup(struct file *old_filp, char *name, struct file *new_filp) {
  struct file *filp = NULL;
  static int malloc_count = 0;
  static int mesg = 1;
  int error;

  START(namei,lookup);
  namei_lookup_count++;

  if (namei_cache_lookup(old_filp,name,&filp)) {
    *new_filp = *filp;
  } else {
    /* miss */
    error = DOOP(old_filp,lookup,(old_filp,name,new_filp));
    if (error) {
//      NAMEI_RELEASE(old_filp,&release);
#ifdef NAMEIDEBUG
      printf("LOOKUP old_filp %s failed errno: %s\n",next,strerror(errno));
#endif
      STOP(namei,lookup);
      return -1;
    }
    if (mesg) filp = (struct file *)__malloc(sizeof (struct file));
    if (filp == 0 && mesg) {
      kprintf("malloc failed (on try: %d\n",malloc_count);
      mesg = 0;
    } else {
      malloc_count++;
      *filp = *new_filp;
      namei_cache_add(old_filp,name,filp);
    }
  }
  STOP(namei,lookup);
  return 0;
}
开发者ID:aunali1,项目名称:exopc,代码行数:36,代码来源:namei_cache.c


注:本文中的START函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。