delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/12/30/22:39:12

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3FF244CA.6040108@zeroc.com>
Date: Wed, 31 Dec 2003 13:38:50 +1000
From: Michi Henning <michi AT zeroc DOT com>
Organization: ZeroC, Inc.
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: SetConsoleCtrlHandler problem

Hi,

it appears that Windows binaries won't run correctly under cygwin/bash
if they use SetConsoleCtrlHandler(). I've attached a trivial program
below. If you run this from a Windows console window, it prints
"handler called" every time you hit Ctrl-C. When run from a cygwin bash
window, the program exits after calling the handler with status 130.

Shouldn't the same binary behave identically, regardless of whether
I run it from cygwin/bash or a console window?

I'd appreciate any help to get the Windows behavior for such binaries
under cygwin.

Thanks,

Michi.

#include <Windows.h>
#include <iostream>

static BOOL handler(DWORD sig)
{
     std::cout << "handler called" << std::endl;
     return 1;
}

int main()
{
     SetConsoleCtrlHandler((PHANDLER_ROUTINE)handler, true);
     for(;;)
	;
     return 0;
}



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019