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

C++ set_signal函数代码示例

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

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



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

示例1: sig_tstop

RETSIGTYPE
sig_tstop(int i)	/* SIGTSTP handler */

{
    /* move to the lower left */
    screen_end();
    fflush(stdout);

    /* default the signal handler action */
    set_signal(SIGTSTP, SIG_DFL);

    /* unblock the TSTP signal */
    release_signal(SIGTSTP);

    /* send ourselves a TSTP to stop the process */
    (void) kill(0, SIGTSTP);

    /* reset the signal handler */
    set_signal(SIGTSTP, sig_tstop);

    /* reinit screen */
    screen_reinit();

    /* jump back to a known place in the main loop */
    longjmp(jmp_int, JMP_RESUME);

    /* NOTREACHED */
}
开发者ID:alexandermerritt,项目名称:dragonfly,代码行数:28,代码来源:top.c


示例2: init

void init(int_ choice){
	server_loop_code = new loop_t;
	reserve_ids();
	console_init();
	load_previous_server_state();
	server_loop_code->array.name = "server loop code";
	//signal(SIGINT, simple_signal_handler);
	switch(choice){
	case 1:
		server_info_init();
		if(check_for_parameter("--net-disable", argc_, argv_) == false) net_init();
		if(check_for_parameter("--physics-disable", argc_, argv_) == false) physics_init();
		if(check_for_parameter("--gametype-disable", argc_, argv_) == false) gametype_init();
		if(check_for_parameter("--input-disable", argc_, argv_) == false) input_init(); // signals should still work from the console
		break;
	case 2:
		test_logic_init();
		break;
	case 3:
		set_signal(SIGTERM, true);
		break;
	default:
		printf("WARNING: This was NOT one of the options, terminating\n");
		set_signal(SIGTERM, true);
		break;
	}
	server_time = new server_time_t;
}
开发者ID:Sishio,项目名称:cyberpvnk,代码行数:28,代码来源:server_main.cpp


示例3: query_key

void input_t::keyboard_to_signal(){
	const bool alt_key = query_key(SDL_SCANCODE_LALT) || query_key(SDL_SCANCODE_RALT);
	if(unlikely(alt_key)){
		if(query_key(SDL_SCANCODE_1)){
			set_signal(SIGNAL_QUIT_LOOP, true);
		}else{
			set_signal(SIGNAL_QUIT_LOOP, false);
		}
	}
}
开发者ID:Sishio,项目名称:cyberpvnk,代码行数:10,代码来源:input_main.cpp


示例4: set_signals

void set_signals( void )
  {
#ifdef SIGWINCH
  sigwinch_handler( SIGWINCH );
  if( isatty( 0 ) ) set_signal( SIGWINCH, sigwinch_handler );
#endif
  set_signal( SIGHUP, sighup_handler );
  set_signal( SIGQUIT, SIG_IGN );
  set_signal( SIGINT, sigint_handler );
  }
开发者ID:orenwatson,项目名称:orens-fun-ed,代码行数:10,代码来源:signal.c


示例5: set_signals

void
set_signals()

{
    (void) set_signal(SIGINT, sig_leave);
    (void) set_signal(SIGQUIT, sig_leave);
    (void) set_signal(SIGTSTP, sig_tstop);
#ifdef SIGWINCH
    (void) set_signal(SIGWINCH, sig_winch);
#endif
}
开发者ID:alexandermerritt,项目名称:dragonfly,代码行数:11,代码来源:top.c


示例6: init_window

void init_window(void)
{
    load_setting();
    
    //メインウィンドウの外観の設定
    main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(main_window), "cedit");
    gtk_window_set_icon(GTK_WINDOW(main_window), get_icon("icon.png"));
    gtk_window_move(GTK_WINDOW(main_window), window_x, window_y);
    gtk_window_set_default_size(GTK_WINDOW(main_window), window_width, window_height);
    
    //ウィンドウの内部の設定
    GtkWidget *main_vbox = gtk_vbox_new(FALSE, 3);
    gtk_container_add(GTK_CONTAINER(main_window), main_vbox);
    init_bar(main_vbox);
    init_editor(main_vbox);
    
    //全体の動作の設定
    init_tag();
    init_library();
    set_action("New", FALSE);
    set_action("Save", FALSE);
    set_action("Undo", FALSE);
    set_action("Redo", FALSE);
    set_action("Cut", FALSE);
    set_action("Copy", FALSE);
    set_action("Delete", FALSE);
    static GtkTargetEntry target[] = {{"text/uri-list",  0, 10}};
    gtk_drag_dest_set(view, GTK_DEST_DEFAULT_ALL, target, 1, GDK_ACTION_COPY);
    gtk_drag_dest_set(main_window, GTK_DEST_DEFAULT_ALL, target, 1, GDK_ACTION_COPY);
    set_signal();
}
开发者ID:kawatea,项目名称:cedit,代码行数:32,代码来源:init.c


示例7: main

int				main(int ac, char **av, char **env)
{
	t_sh		*sh;
	int			stop;

	create_env(env);
	env = add_builtin_pid(env);
	set_signal();
	if (ac > 1)
		(void)av;
	else
	{
		stop = 0;
		sh = get_sh(&stop);
		set_terminal(sh);
		while (!stop)
		{
			sh->ft_stdin = dup(STDIN_FILENO);
			sh->ft_stdout = dup(STDOUT_FILENO);
			start_sh(sh);
			ft_putenv("PID_EXECV", NULL);
		}
	}
	return (0);
}
开发者ID:vlehuger,项目名称:42sh,代码行数:25,代码来源:main.c


示例8: signal_function

void signal_function(int signal){
	if(pull_signal(SIGTERM) && signal == SIGTERM){
		printf("Halting the program because of a hang in the loop\n");
		assert(false);
	}
	set_signal(signal, true);
}
开发者ID:Sishio,项目名称:cyberpvnk,代码行数:7,代码来源:input_main.cpp


示例9: main

int main(void)
{
    tls_client_t client = {0};
    const char *gnutls_ver = NULL;
    time_t start = 0;
    time_t end = 0;
    int ret = 0;
    int i = 0;

    /* initialise signal handling */
    set_signal();

    coap_log_set_level(COAP_LOG_DEBUG);

    gnutls_ver = gnutls_check_version(NULL);
    if (gnutls_ver == NULL)
    {
        coap_log_error("Unable to determine GnuTLS version");
        return EXIT_FAILURE;
    }
    coap_log_info("GnuTLS version: %s", gnutls_ver);

    ret = tls_init();
    if (ret != SOCK_OK)
    {
        coap_log_error("%s", sock_strerror(ret));
        return EXIT_FAILURE;
    }

    ret = tls_client_create(&client, TRUST_FILE_NAME, CERT_FILE_NAME, KEY_FILE_NAME);
    if (ret != SOCK_OK)
    {
        coap_log_error("%s", sock_strerror(ret));
        tls_deinit();
        return EXIT_FAILURE;
    }

    for (i = 0; i < NUM_ITER; i++)
    {
        start = time(NULL);
        ret = client_run(&client);
        end = time(NULL);
        if (ret != SOCK_OK)
        {
            coap_log_error("%s", sock_strerror(ret));
            tls_client_destroy(&client);
            tls_deinit();
            return EXIT_FAILURE;
        }
        coap_log_info("Result: %s", sock_strerror(ret));
        coap_log_debug("Time: %d sec", (int)(end - start));
        coap_log_debug("Sleeping for %d seconds...", DELAY);
        sleep(DELAY);
    }

    tls_client_destroy(&client);
    tls_deinit();
    return EXIT_SUCCESS;
}
开发者ID:Rahuldee,项目名称:FreeCoAP,代码行数:59,代码来源:test_tls_client.c


示例10: gld_fork

pid_t gld_fork(void)
{
  pid_t pid;
  
  pid = fork();
  if (pid == (pid_t)-1)
  {
    syslog(LOG_CRIT,"fork() = %s",strerror(errno));
    return(pid);
  }
  else if (pid > (pid_t)0)	/* parent returns immediately */
    return(pid);
  
  /*---------------------------------------------------
  ; set the environment for the child process.
  ;--------------------------------------------------*/

  alarm(0);	/* turn off any pending alarms */
  
  set_signal(SIGSEGV,sighandler_critical_child);
  set_signal(SIGBUS, sighandler_critical_child);
  set_signal(SIGFPE, sighandler_critical_child);
  set_signal(SIGILL, sighandler_critical_child);
  set_signal(SIGXCPU,sighandler_critical_child);
  set_signal(SIGXFSZ,sighandler_critical_child);
  set_signal(SIGPIPE,sighandler_critical_child);

  return(pid);
}
开发者ID:spc476,项目名称:x-grey,代码行数:29,代码来源:signals.c


示例11: do_standalone_mode

static void do_standalone_mode(gboolean daemonize)
{
	int ret;
	int lsock[MAXSOCK];
	struct addrinfo *ai_head;
	int n;



	ret = usbip_names_init(USBIDS_FILE);
	if (ret)
		err("open usb.ids");

	ret = usbip_stub_driver_open();
	if (ret < 0)
		g_error("driver open failed");

	if (daemonize) {
		if (daemon(0,0) < 0)
			g_error("daemonizing failed: %s", g_strerror(errno));

		usbip_use_syslog = 1;
	}

	set_signal();

	ai_head = my_getaddrinfo(NULL, PF_UNSPEC);
	if (!ai_head)
		return;

	n = listen_all_addrinfo(ai_head, lsock);
	if (n <= 0)
		g_error("no socket to listen to");

	for (int i = 0; i < n; i++) {
		GIOChannel *gio;

		gio = g_io_channel_unix_new(lsock[i]);
		g_io_add_watch(gio, (G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL),
				process_comming_request, NULL);
	}


	info("usbipd start (%s)", version);


	main_loop = g_main_loop_new(FALSE, FALSE);
	g_main_loop_run(main_loop);

	info("shutdown");

	freeaddrinfo(ai_head);
	usbip_names_free();
	usbip_stub_driver_close();

	return;
}
开发者ID:wl500g,项目名称:usbip-no-glib,代码行数:57,代码来源:stub_server.c


示例12: th_start

void th_start()
{
	if (th_initialized) return;
	main_thread.u = &main_data;
	threads[0] = &main_thread;
	th_it = 1;
	set_signal(dispatcher);
	th_initialized = 1;
}
开发者ID:chiehmin,项目名称:nctu-os-99,代码行数:9,代码来源:switch.c


示例13: set_signal

FeatureExtractionSpectral::FeatureExtractionSpectral(SAMPLE* signal, int bufSize, int fs, int winSize, int hopSize){
	set_signal(signal);
	set_bufSize(bufSize);
	set_fs(fs);
	set_winSize(winSize);
	set_hopSize(hopSize);
	calculate_fBinSize();
	calculate_magSpec();
}
开发者ID:binarybruin,项目名称:cfel,代码行数:9,代码来源:cfelTest.cpp


示例14: handle_sigint

static void handle_sigint(void)
{
  syslog(LOG_DEBUG,"Interrupt Signal");

  save_state();
  GlobalsDeinit();
  set_signal(SIGINT,SIG_DFL);
  raise(SIGINT);
}
开发者ID:spc476,项目名称:x-grey,代码行数:9,代码来源:signals.c


示例15: handle_sigquit

static void handle_sigquit(void)
{
  syslog(LOG_DEBUG,"Quit signal");

  save_state();
  GlobalsDeinit();
  set_signal(SIGQUIT,SIG_DFL);
  raise(SIGQUIT);
}
开发者ID:spc476,项目名称:x-grey,代码行数:9,代码来源:signals.c


示例16: handle_sigterm

static void handle_sigterm(void)
{
  syslog(LOG_DEBUG,"Terminate Signal");

  save_state();
  GlobalsDeinit();
  set_signal(SIGTERM,SIG_DFL);
  raise(SIGTERM);
}
开发者ID:spc476,项目名称:x-grey,代码行数:9,代码来源:signals.c


示例17: main

int main(int argc, char *argv[])
{
	pid_t 		pid ;
	int 		stat ;
	pthread_t	pthread_cancel_id, pthread_sms_id, pthread_cois_id ;	
	int			ret ;

	isDup(argv[0]) ;

	if((pid = fork()) < 0)
		return  -1;
	else    if(pid != 0)
		exit(0);

	setsid() ;

	set_signal() ;

	if (argc > 1) {
		if (argc == 3) {
			if (strcmp(argv[1], "-f") == 0) {
				strcpy(config_file_path, argv[2]);
			}
			else    {
				printf("---------------------------------\n");
				printf("-%s [-f ConfigFilePath]\n", argv[0]);
				printf("---------------------------------\n");
				}
			}
		else    {
			printf("---------------------------------\n");
			printf("-%s [-f ConfigFilePath]\n", argv[0]);
			printf("---------------------------------\n");
		}
	}
	else
		sprintf(config_file_path, "../config/TCenter.Config");

	memset(&Config, 0, sizeof(CONFIG_T)) ;
	readConfig(config_file_path, &Config) ;
	Log = openLog(argv[0], Config.LOG_FILE, LOG_MODE) ;
#ifdef _FOR_STAT_
	StatLog = openLog(argv[0], Config.STAT_LOG_PATH, LOG_MODE) ;
#endif
	printLog(HEAD, "=====[Program Start]=====\n") ;

	printConfig(&Config) ;

	pthread_mutex_init(&p_lock, NULL);
	thread_count = 0;

	Worker() ;

	exit_handler() ;
	return M_TRUE ;
}
开发者ID:k2b3d,项目名称:tconsrc,代码行数:56,代码来源:Main.c


示例18: skeleton_init

bool skeleton_init(const char* appname, int loglvl, int maxfdcnt)
{
	set_rlimit();
	set_signal();
	init_log(appname);
	set_log_level(loglvl);
	toggle_hex_level();
	init_timer();

	return gevloop.init(maxfdcnt);
}
开发者ID:wonghoifung,项目名称:tips,代码行数:11,代码来源:skeleton.cpp


示例19:

StringButton::StringButton(const QString string, int height, int width, int fontsize, QWidget *parent)
{
    str = string;
    QString help = help.number(fontsize);
    help = help.append("pt");
    help = help.prepend("font-size: ");

    this->setText(string);
    this->setMaximumHeight(height);
    this->setMinimumHeight(height);
    this->setMaximumWidth(width);
    this->setMinimumWidth(width);
    this->setStyleSheet(help);
    QObject::connect(this,SIGNAL(clicked()),this,SLOT(set_signal()));
}
开发者ID:jcrohde,项目名称:MACE,代码行数:15,代码来源:stringbutton.cpp


示例20: interrupts_set

/* enables or disables interrupts, and returns whether interrupts were enabled
 * or not previously. */
int
interrupts_set(int enabled)
{
	int ret;
	sigset_t mask, omask;

	set_signal(&mask);
	if (enabled) {
		ret = sigprocmask(SIG_UNBLOCK, &mask, &omask);
	} else {
		ret = sigprocmask(SIG_BLOCK, &mask, &omask);
	}
	assert(!ret);
	return (sigismember(&omask, SIG_TYPE) ? 0 : 1);
}
开发者ID:CEYeYuan,项目名称:operating-systems,代码行数:17,代码来源:interrupt.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ set_signal_handler函数代码示例发布时间:2022-05-30
下一篇:
C++ set_short函数代码示例发布时间: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