Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'specifying': 0.07; 'stuff,': 0.07; 'subject:process': 0.07; '+0200,': 0.09; 'conditional': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'relies': 0.09; 'win32': 0.12; 'attached,': 0.16; 'bieber': 0.16; 'control-c': 0.16; 'declaimed': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'mutex,': 0.16; 'received:66.245': 0.16; 'received:dsl.mindspring.com': 0.16; 'received:mindspring.com': 0.16; 'received:wlfraed': 0.16; 'subject:sending': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'way...': 0.16; 'win32event': 0.16; 'wulfraed': 0.16; 'possibly': 0.16; 'part,': 0.19; 'integer': 0.23; 'weight': 0.23; 'suspect': 0.25; 'url:home': 0.25; 'handles': 0.26; 'specified': 0.26; 'windows': 0.26; 'object': 0.26; 'says': 0.27; '(the': 0.28; 'lee': 0.29; 'module': 0.30; 'sun,': 0.30; 'seem': 0.32; 'header:X-Complaints- To:1': 0.32; 'to:addr:python-list': 0.33; 'list': 0.33; "i've": 0.33; 'install': 0.34; 'light': 0.34; 'there': 0.35; 'using': 0.35; 'charset:us-ascii': 0.36; 'open': 0.36; 'probably': 0.36; 'another': 0.37; 'pretty': 0.37; 'two': 0.37; 'received:org': 0.38; 'anything': 0.38; 'but': 0.38; 'though': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'current': 0.40; 'help': 0.40; 'waiting': 0.61; 'here': 0.66; 'subject: ': 0.73; 'dennis': 0.77; '"standard"': 0.84; "(don't": 0.84; 'add-on': 0.84; 'isolate': 0.84; 'news123': 0.84; 'window,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: portable way of sending notifying a process Date: Sun, 29 May 2011 00:09:22 -0700 Organization: > Bestiaria Support Staff < References: <4de183e7$0$26108$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: user-11fa9ub.dsl.mindspring.com X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 44 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306652974 news.xs4all.nl 49038 [::ffff:82.94.164.166]:47872 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6516 On Sun, 29 May 2011 01:23:18 +0200, News123 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/