Beispiel #1
0
void error_async(struct mrpc_connection *conn)
{
	mrpc_status_t ret;

	inc_pending();
	ret=proto_error_async(conn, cb_error, MSGPRIV);
	if (ret)
		die("Couldn't send async error: %d", ret);
}
Beispiel #2
0
void trigger_callback_async(struct mrpc_connection *conn)
{
	mrpc_status_t ret;

	inc_pending();
	ret=proto_trigger_callback_async(conn, cb_expect_success,
				"Trigger-callback");
	if (ret)
		die("Couldn't send async trigger-callback: %d", ret);
}
Beispiel #3
0
void check_int_async(struct mrpc_connection *conn)
{
	struct IntParam request;
	mrpc_status_t ret;

	request.val=INT_VALUE;
	inc_pending();
	ret=proto_check_int_async(conn, cb_expect_success, "Check-correct",
				&request);
	if (ret)
		die("Couldn't send async check: %d", ret);
	free_IntParam(&request, 0);

	request.val=12;
	inc_pending();
	ret=proto_check_int_async(conn, cb_expect_one, "Check-incorrect",
				&request);
	if (ret)
		die("Couldn't send async check: %d", ret);
	free_IntParam(&request, 0);
}
Beispiel #4
0
void loop_int_async(struct mrpc_connection *conn)
{
	struct IntParam request;
	mrpc_status_t ret;

	request.val=INT_VALUE;
	inc_pending();
	ret=proto_loop_int_async(conn, cb_loop, MSGPRIV, &request);
	if (ret)
		die("Couldn't send async loop: %d", ret);
	free_IntParam(&request, 0);
}
Beispiel #5
0
int generic_handler(DWORD signo) {

	int blocked=0;

	if (SIGBAD(signo) )
		return FALSE;
	switch (signo) {
		case SIGINT:
			if (handlers[signo] != SIG_IGN){
				if (fast_sigmember(&gBlockMask,signo) ) {
					inc_pending(signo);
					blocked=1;
				}
				else if (handlers[signo] == SIG_DFL)
					ExitProcess(0xC000013AL);
				else
					handlers[signo](signo);
			}
			break;
		case SIGBREAK:
			if (handlers[signo] != SIG_IGN){
				if (fast_sigmember(&gBlockMask,signo) ) {
					inc_pending(signo);
					blocked=1;
				}
				else if (handlers[signo] == SIG_DFL)
					ExitProcess(0xC000013AL);
				else
					handlers[signo](signo);
			}
			break;
		case SIGHUP: //CTRL_CLOSE_EVENT
			if (handlers[signo] != SIG_IGN){
				if (fast_sigmember(&gBlockMask,signo) ) {
					inc_pending(signo);
					blocked=1;
				}
				else if (handlers[signo] == SIG_DFL)
					ExitProcess(604);
				else
					handlers[signo](signo);
			}
			break;
		case SIGTERM: //CTRL_LOGOFF_EVENT
			if (handlers[signo] != SIG_IGN){
				if (fast_sigmember(&gBlockMask,signo) ) {
					inc_pending(signo);
					blocked=1;
				}
				else if (handlers[signo] == SIG_DFL)
					ExitProcess(604);
				else
					handlers[signo](signo);
			}
			else
				ExitProcess(604);
			break;
		case SIGKILL: //CTRL_SHUTDOWN_EVENT
			if (handlers[signo] != SIG_IGN){
				if (fast_sigmember(&gBlockMask,signo) ) {
					inc_pending(signo);
					blocked=1;
				}
				else if (handlers[signo] == SIG_DFL)
					ExitProcess(604);
				else
					handlers[signo](signo);
			}
			else
				ExitProcess(604);
			break;
		case SIGALRM:
			if (handlers[signo] != SIG_IGN){
				if (fast_sigmember(&gBlockMask,signo) ) {
					inc_pending(signo);
					blocked=1;
				}
				else if (handlers[signo] == SIG_DFL)
					ExitProcess(604);
				else
					handlers[signo](signo);
			}
			break;
		case SIGCHLD:
			if (handlers[signo] != SIG_IGN){
				if (fast_sigmember(&gBlockMask,signo) ) {
                    dprintf("inc pending for sig %d count %d\n",signo,
                        gPending[signo]);
					inc_pending(signo);
					blocked=1;
				}
				else if (handlers[signo] != SIG_DFL)
					handlers[signo](signo);
			}
			break;
		default:
			ExitProcess(604);
			break;
	}
    if (!blocked && __is_suspended) {
        EnterCriticalSection(&sigcritter);
        __is_suspended--;
        LeaveCriticalSection(&sigcritter);
        dprintf("releasing suspension is_suspsend = %d\n",__is_suspended);
        SetEvent(hsigsusp);
    }
	return TRUE;
}