On Tue, 3 Feb 2004, Lutz Hörl wrote: > -----Ursprüngliche Nachricht----- > Von: Igor Pechtchanski [mailto:pechtcha<at>cs<dot>nyu<dot>edu]
Please don't quote raw e-mail addresses in your replies. Let's not make the spam harvesters' life any easier. > Gesendet: Dienstag, 3. Februar 2004 16:55 > An: Lutz Hörl > Cc: cygwin<at>cygwin<dot>com > Betreff: Re: Is there a translation from windows events to cygwin signals ? > > On Tue, 3 Feb 2004, Lutz Hörl wrote: > > > Hello, > > > > My problem: > > > > I have to send a signal to a running cygwin application, but I can not > > use the cygwin API for this purpose. > > This doesn't make sense. You can always do system("c:/cygwin/bin/kill -HUP > <cygwin_pid>"). > > > This signal (e.g. SIGHUP) can be cought by my cywin application, the > > application can react on it in a proper way. > > > > Until now I found only documentation that states that the cygwin > > signals rely on windows events but no documentation on how to use this > > mechanism. > > > > Is there a 'translation' from windows events into signals ? Is there a > > way to use then Win32 "BroadcastSystemMessage()" function to send a > > Signal to cygwin application ? > > > > Thank you all > > Lutz Hoerl > > Cygwin signals use Windows events under the covers, but there's more to > Cygwin signals than just Windows events. There's no one-to-one mapping. > Use "kill". > Igor BTW, your quoting method caused pine (and will probably cause any signature_prefix-respecting browser) to cut off your reply (because it follows my signature). > Thank you Igor! > I know it sounds ugly, but let me go a little more into detail. > > I want to do the following: > Start a native Win32 application, let us call it the 'frontend'. > This frontend starts and stops some cygwin applications. Start is no > problem, I can do this with the Win32's CreateProcess() function. > Therefrom I get the applications HANDLE. For stopping the application I > want to use this HANDLE but I do not want to use the Win32's > TerminateProcess() function to stop the process because that gives the > (cygwin-) applications no time to save anything. That is the reason why > I am looking for a SIGNAL-sending capability from Win32 applications. > > When I listen to your answer I can imagine what to do in my Win32 App.: > 1. start the cygwin application via CreateProcess(), get a HANDLE > 2. obtain the process' Win32-PID from the obtain HANDLE > 3. use the cygwin win_pid to cygwin_pid function > 4. use the cygwin kill() function with this pid to send a signal to the > cygwin application > 5. wait for the cygwin application to exit > > That means to compile the Win32 application with a DLL that does steps 2 > to 5. > > Can you confirm that this is the way ? > I would be happy to read about a shorter way. > > Thank you again > Lutz Hoerl FWIW, Cygwin's kill() understands Win32 PIDs, so you can at least skip step 3. I suggest looking at Cygwin's implementation of /bin/kill (in CVS as winsup/utils/kill.cc). Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ [EMAIL PROTECTED] ZZZzz /,`.-'`' -. ;-;;,_ [EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "I have since come to realize that being between your mentor and his route to the bathroom is a major career booster." -- Patrick Naughton -- 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/