• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_signals函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int main(int argc, char *argv[])
{
    SETUP_THE_NUMBERS;
    TEARDOWN_THE_NUMBERS;
    char *char_string = string("asdasd");
    int c;

    while ((c = getopt(argc, argv, "hv")) != -1) {
        switch (c) {
            case 'h':
                print_help_message();
                prepare_for_exit();
                return EXIT_FAILURE;
            case 'v':
                print_licence_message();
                prepare_for_exit();
                return EXIT_FAILURE;
        }
    }
    random_init();
    set_signals();
    init_windows();
    init_modes();

    loop();

    prepare_for_exit();
    free_memory();
    return EXIT_SUCCESS;
}
开发者ID:buharin,项目名称:fastbuild_python,代码行数:30,代码来源:main.c


示例2: main

int main(int argc, char **argv) {
    pthread_t threads[NUM_THREADS];

    if (argc > 1) {
	fprintf(stderr, "Usage: %s\n", *argv);
	exit(1);
    }

    /* remember to ignore certain signals */
    set_signals();

    /* go do it */
    for (long i = 0; i < NUM_THREADS; i++) {
	int rc = pthread_create(&threads[i], NULL, resolver_thread_root, (void *) i);
	if (rc) {
	    printf("ERROR; return code from pthread_create() is %d\n", rc);
	    exit(-1);
	}
    }
    for (long i = 0; i < NUM_THREADS; i++) {
	void *retval;
	pthread_join(threads[i], &retval);
    }

    fprintf(stderr, "Resolver exited.\n");

    exit(0);
}
开发者ID:foxbird,项目名称:fuzzball,代码行数:28,代码来源:resolver.c


示例3: run_init_svc

int run_init_svc(char *cinit_svc)
{
   pid_t pid;

   /*
    * leave cinit alone 
    */
   pid = fork();

   if(pid == -1) {              /* err */
      print_errno(MSG_ERR_FORK);
      return 0;
   } else if(pid == 0) {        /* child */
      cinit_ipc_sclose();
      set_signals(ACT_CLIENT);

      if(!cinit_ipc_logon())
         _exit(1);

      /*
       * FIXME: open stderr, stdin, stdout to files / syslog / logable ?
       * IMPLEMENT PER SERVICE! 
       */

      run_svc(cinit_svc);

      _exit(0);                 /* nobody cares about us, so exit successfully
                                 * anyway */
   }
   /*
    * parent exits, we don't care about our children 
    */
   return 1;
}
开发者ID:telmich,项目名称:cinit,代码行数:34,代码来源:run_init_svc2.c


示例4: sig_handler

void sig_handler(ARCH_SIGHDLR_PARAM)
{
	struct sigcontext *sc;
	int enabled;

	/* Must be the first thing that this handler does - x86_64 stores
	 * the sigcontext in %rdx, and we need to save it before it has a
	 * chance to get trashed.
	 */

	ARCH_GET_SIGCONTEXT(sc, sig);

	enabled = signals_enabled;
	if(!enabled && (sig == SIGIO)){
		pending |= SIGIO_MASK;
		return;
	}

	block_signals();

	CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas,
			 sig, sc);

	set_signals(enabled);
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:25,代码来源:signal.c


示例5: new_thread

void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
		void (*handler)(int))
{
	unsigned long flags;
	sigjmp_buf switch_buf, fork_buf;

	*switch_buf_ptr = &switch_buf;
	*fork_buf_ptr = &fork_buf;

	/* Somewhat subtle - siglongjmp restores the signal mask before doing
	 * the longjmp.  This means that when jumping from one stack to another
	 * when the target stack has interrupts enabled, an interrupt may occur
	 * on the source stack.  This is bad when starting up a process because
	 * it's not supposed to get timer ticks until it has been scheduled.
	 * So, we disable interrupts around the sigsetjmp to ensure that
	 * they can't happen until we get back here where they are safe.
	 */
	flags = get_signals();
	block_signals();
	if(sigsetjmp(fork_buf, 1) == 0)
		new_thread_proc(stack, handler);

	remove_sigstack();

	set_signals(flags);
}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:26,代码来源:process.c


示例6: iteration_func

gboolean iteration_func(gpointer data)
{
	mcpanel *panel = data;

	if (!run_eeg)
		return FALSE;

	set_signals(geeg, gexg, gtri, NSAMPLES);
	mcp_add_samples(panel, 0, NSAMPLES, geeg);
	mcp_add_samples(panel, 1, NSAMPLES, geeg);
	mcp_add_samples(panel, 2, NSAMPLES, gexg);
	mcp_add_triggers(panel, NSAMPLES, gtri);
	isample += NSAMPLES;

	if (recording) {
		recsamples += NSAMPLES;
		if (recsamples > 201*NSAMPLES) {
			recording = 0;
			mcp_notify(panel, REC_PAUSED);
		}
	}

	if ((isample<201*NSAMPLES)&&(isample >= 200*NSAMPLES)) {
		mcp_popup_message(panel, "Hello!");
		isample = 201*NSAMPLES;
	}
	return TRUE;
}
开发者ID:nbourdau,项目名称:mcpanel,代码行数:28,代码来源:signal_panel.c


示例7: main

// A very basic example...
// when the user types a character, print it back
int main(void)
{
    uint8_t signals[3] = {0, 0, 0};

	CPU_PRESCALE(0);  // run at 16 MHz

    pwm_init();
	uart_init(BAUD_RATE);
    set_signals(signals);

	while (1) {
		if (uart_available()) {
            uart_get_pwms(signals);
            set_signals(signals);
		}
	}
}
开发者ID:PSU-AVT,项目名称:MonkeyPlane,代码行数:19,代码来源:main.c


示例8: restart

static void			restart(int signum)
{
	t_environment	*env;

	(void)signum;
	env = get_set_environment(NULL);
	setup_terminal(env);
	set_signals(&restart);
	refresh_screen(0);
}
开发者ID:marcobooth,项目名称:ft_select,代码行数:10,代码来源:main.c


示例9: main

int main (int argc, char **argv) { 

    leave_suid();
    
    if ( (program = strrchr(argv[0], '/')) == 0 ) 
        program = argv[0]; 
    else 
        program ++;
    
    parse_args(argc, argv);

    debug("start up");

    initlog(program, facility, logfile);

    debug("init log"); 
    
#ifndef NO_FORK
    
    if (daemon_mode) { 
        if (daemon(0, 0)) 
            av_shutdown(1); 
    } 
#endif

    set_signals(); 
    signal(SIGPIPE, SIG_IGN);
    
    if (create_pid_file())          /* bug - don't call shutdown - it removes pidfile */ 
        av_shutdown(1);

    notice("started");

    if ( !no_check && (drweb_ver = dw_getversion()) != -1 ) {
        notice("drwebd %d.%d found", drweb_ver/100, drweb_ver % 100);
    }
    else {
        no_check = 1;
    }

    if ( !no_check && (drweb_id = dw_getid()) != NULL ) {
        notice("drwebd id = <%s>", drweb_id );
    }

    if ( !no_check ) {
        dw_getbaseinfo();
    }

    main_loop();

    av_shutdown(0);
    

    return 0;
}
开发者ID:AlexeyDemidov,项目名称:avsmtpd,代码行数:55,代码来源:avsmtpd.c


示例10: proc_start

struct tmuxproc *
proc_start(const char *name, struct event_base *base, int forkflag,
    void (*signalcb)(int))
{
	struct tmuxproc	*tp;
	struct utsname	 u;

#ifdef TMATE_SLAVE
	if (forkflag)
		fatal("can't fork");
#else
	if (forkflag) {
		switch (fork()) {
		case -1:
			fatal("fork failed");
		case 0:
			break;
		default:
			return (NULL);
		}
		if (daemon(1, 0) != 0)
			fatal("daemon failed");

		clear_signals(0);
		if (event_reinit(base) != 0)
			fatalx("event_reinit failed");
	}
	log_open(name);
#endif

#ifdef HAVE_SETPROCTITLE
	setproctitle("%s (%s)", name, socket_path);
#endif

	if (uname(&u) < 0)
		memset(&u, 0, sizeof u);

	log_debug("%s started (%ld): socket %s, protocol %d", name,
	    (long)getpid(), socket_path, PROTOCOL_VERSION);
	log_debug("on %s %s %s; libevent %s (%s)", u.sysname, u.release,
	    u.version, event_get_version(), event_get_method());

	tp = xcalloc(1, sizeof *tp);
	tp->name = xstrdup(name);

#ifndef TMATE_SLAVE
	tp->signalcb = signalcb;
	set_signals(proc_signal_cb, tp);
#endif

	return (tp);
}
开发者ID:abergmann,项目名称:tmate-slave,代码行数:52,代码来源:proc.c


示例11: main

int main(int argc, char **argv)
{
    set_signals();
    getargs(argc, argv);
    open_files();
    reader();
    lr0();
    lalr();
    make_parser();
    verbose();
    output();
    done(0);
    return 0;
}
开发者ID:sunfirefox,项目名称:btyacc,代码行数:14,代码来源:main.c


示例12: main

int					main(int argc, char **argv)
{
	t_environment	*env;

	if (argc < 2)
		ft_putendl_fd_exit("Usage: ft_select [parameters]", 2, 1);
	env = malloc(sizeof(t_environment));
	setup_environment(env, argc, argv);
	get_set_environment(env);
	set_signals(&restart);
	refresh_screen(0);
	input_loop();
	return (0);
}
开发者ID:marcobooth,项目名称:ft_select,代码行数:14,代码来源:main.c


示例13: timer_alarm_handler

void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc)
{
	int enabled;

	enabled = signals_enabled;
	if (!signals_enabled) {
		signals_pending |= SIGALRM_MASK;
		return;
	}

	block_signals();

	timer_real_alarm_handler(mc);
	set_signals(enabled);
}
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:15,代码来源:signal.c


示例14: main

int
main (int argc, char *argv[])
{
    set_signals();
    getargs(argc, argv);
    open_files();
    reader();
    lr0();
    lalr();
    make_parser();
    verbose();
    output();
    done(0);
    /*NOTREACHED*/
}
开发者ID:LogosBible,项目名称:mono,代码行数:15,代码来源:main.c


示例15: alarm_handler

void alarm_handler(int sig, mcontext_t *mc)
{
	int enabled;

	enabled = signals_enabled;
	if (!signals_enabled) {
		signals_pending |= SIGVTALRM_MASK;
		return;
	}

	block_signals();

	real_alarm_handler(mc);
	set_signals(enabled);
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:15,代码来源:signal.c


示例16: main

int main(int argc, char *argv[])
{
    set_folders();
    initialize();
    set_signals();
    
    //Iniciar el cliente como servidor de ficheros
    if (init_client() == -1)
	error("Error on init client");

    while(1)
     {
          userin();
          procline();
     }
}
开发者ID:plineo,项目名称:scf,代码行数:16,代码来源:scf_client.c


示例17: main

int
main(int argc, char **argv)
{
    atexit(cleanup);
    set_signals();
    getargs(argc, argv);
    open_files();
    reader();
    lr0();
    lalr();
    make_parser();
    verbose();
    output();
    exit(0);
    /*NOTREACHED*/
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:16,代码来源:main.c


示例18: main

int main(int argc, char *argv[])
{
	set_signals();
	byacc_getargs(argc, argv);
	open_files();
	reader();
	lr0();
	lalr();
	make_parser();
	verbose();
	output();
	done(EXIT_SUCCESS);

	/*NOTREACHED*/
	exit(EXIT_SUCCESS);
}
开发者ID:BackupTheBerlios,项目名称:elastic-svn,代码行数:16,代码来源:main.c


示例19: shell_init

void shell_init() {
    jobs_head = calloc(1, sizeof(*jobs_head));

    on_terminal = (bool) isatty(shell_in);
    if (on_terminal) { /* input on user terminal? */

        set_signals(SIG_IGN, false); /* set shell to ignore most signals */
        signal(SIGTSTP, sigtstp_handler);

        shell_pgid = getpid();
        assert(setpgid(shell_pgid, shell_pgid) >= 0); /* make us a process group leader */

        tcsetpgrp(shell_in, shell_pgid); /* put stdin on foreground */
        tcgetattr(shell_in, &io_flags); /* save terminal mode */
    }
}
开发者ID:SOII-2016,项目名称:impeachellment,代码行数:16,代码来源:shell.c


示例20: sig_handler

void sig_handler(int sig, mcontext_t *mc)
{
	int enabled;

	enabled = signals_enabled;
	if (!enabled && (sig == SIGIO)) {
		signals_pending |= SIGIO_MASK;
		return;
	}

	block_signals();

	sig_handler_common(sig, mc);

	set_signals(enabled);
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:16,代码来源:signal.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_size函数代码示例发布时间:2022-05-30
下一篇:
C++ set_signal_handler函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap