Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6516

Re: portable way of sending notifying a process

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: portable way of sending notifying a process
Date 2011-05-29 00:09 -0700
Organization > Bestiaria Support Staff <
References <4de183e7$0$26108$426a74cc@news.free.fr>
Newsgroups comp.lang.python
Message-ID <mailman.2213.1306652974.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, 29 May 2011 01:23:18 +0200, News123 <news1234@free.fr> declaimed
the following in gmane.comp.python.general:
> What would be a light weight portable way, that one process can tell
> another to do something?
> 
> The main requirement would be to have no CPU impact while waiting (thus
> no polling)
>

	I suspect there is no real portable way... Windows, for the most
part, relies upon everything coming in via a "message" to an open
window, or via an "event" object which is specified in one of:

win32event.WaitForSingleObject()
win32event.WaitForMultipleObjects() {which returns if any object in the
list is set}
win32event.MsgWaitForMultipleObjects() {which also returns if a Window
message has been received}

	Note that "object" here is pretty much anything with a "handle"
(Event, Semaphore, Mutex, WaitableTimer, possibly process handles from
OpenProcess and from CreateFile)

	If the other process has a "standard" Windows Console attached,
there is

GenerateConsoleCtrlEvent()

but the only choices seem to be control-c and control-break (the help
for win32api.GenerateConsoleCtrlEvent() just says an integer specifying
the signal, win32console.GenerateConsoleCtrlEvent() gives names for the
two specified)

	All the above are accessed using functions in the win32 add-on
(don't recall the current name, since I've always used the ActiveState
Windows install it's included -- pywin32?)

	You'd probably have to isolate the sending side to a module with
conditional imports/code... Though if you end up with the win32event
stuff, the receiving side is also going to need to be compatible.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

portable way of sending notifying a  process News123 <news1234@free.fr> - 2011-05-29 01:23 +0200
  Re: portable way of sending notifying a  process Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-29 00:09 -0700
  Re: portable way of sending notifying a  process Chris Torek <nospam@torek.net> - 2011-05-30 01:44 +0000
    Re: portable way of sending notifying a process Chris Angelico <rosuav@gmail.com> - 2011-05-30 12:03 +1000
      Re: portable way of sending notifying a process News123 <news1234@free.fr> - 2011-05-30 11:18 +0200

csiph-web