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


C++ set_signals函数代码示例

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


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


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