当前位置: 首页>>代码示例>>Python>>正文


Python win32event.INFINITE属性代码示例

本文整理汇总了Python中win32event.INFINITE属性的典型用法代码示例。如果您正苦于以下问题:Python win32event.INFINITE属性的具体用法?Python win32event.INFINITE怎么用?Python win32event.INFINITE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在win32event的用法示例。


在下文中一共展示了win32event.INFINITE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: wait

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def wait(self, state, interval=0.1, channel=None):
        """Wait for the given state(s), KeyboardInterrupt or SystemExit.

        Since this class uses native win32event objects, the interval
        argument is ignored.
        """
        if isinstance(state, (tuple, list)):
            # Don't wait for an event that beat us to the punch ;)
            if self.state not in state:
                events = tuple([self._get_state_event(s) for s in state])
                win32event.WaitForMultipleObjects(
                    events, 0, win32event.INFINITE)
        else:
            # Don't wait for an event that beat us to the punch ;)
            if self.state != state:
                event = self._get_state_event(state)
                win32event.WaitForSingleObject(event, win32event.INFINITE) 
开发者ID:cherrypy,项目名称:cherrypy,代码行数:19,代码来源:win32.py

示例2: run

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def run(self):
        last_time = os.stat(self.filename)[stat.ST_MTIME]
        while 1:
            try:
                rc = win32event.WaitForSingleObject(self.handle, 
                                                    win32event.INFINITE)
                win32file.FindNextChangeNotification(self.handle)
            except win32event.error, details:
                # handle closed - thread should terminate.
                if details[0] != winerror.ERROR_INVALID_HANDLE:
                    raise
                break
            this_time = os.stat(self.filename)[stat.ST_MTIME]
            if this_time != last_time:
                print "Detected file change - flagging for reload."
                self.change_detected = True
                last_time = this_time 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:19,代码来源:advanced.py

示例3: CollectorThread

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def CollectorThread(stopEvent, file):
	win32trace.InitRead()
	handle = win32trace.GetHandle()
	# Run this thread at a lower priority to the main message-loop (and printing output)
	# thread can keep up
	import win32process
	win32process.SetThreadPriority(win32api.GetCurrentThread(), win32process.THREAD_PRIORITY_BELOW_NORMAL)

	try:
		while 1:
			rc = win32event.WaitForMultipleObjects((handle, stopEvent), 0, win32event.INFINITE)
			if rc == win32event.WAIT_OBJECT_0:
				# About the only char we can't live with is \0!
				file.write(win32trace.read().replace("\0", "<null>"))
			else:
				# Stop event
				break
	finally:
		win32trace.TermRead()
		print "Thread dieing" 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:22,代码来源:TraceCollector.py

示例4: Run

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def Run(self):
		while 1:
			handles = [self.stopEvent, self.adminEvent]
			if self.watchEvent is not None:
				handles.append(self.watchEvent)
			rc = win32event.WaitForMultipleObjects(handles, 0, win32event.INFINITE)
			if rc == win32event.WAIT_OBJECT_0:
				break
			elif rc == win32event.WAIT_OBJECT_0+1:
				self.RefreshEvent()
			else:
				win32api.PostMessage(self.hwnd, MSG_CHECK_EXTERNAL_FILE, 0, 0)
				try:
					# If the directory has been removed underneath us, we get this error.
					win32api.FindNextChangeNotification(self.watchEvent)
				except win32api.error, exc:
					print "Can not watch file", self.doc.GetPathName(), "for changes -", exc.strerror
					break

		# close a circular reference 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:22,代码来源:document.py

示例5: wait

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def wait(self, state, interval=0.1, channel=None):
        """Wait for the given state(s), KeyboardInterrupt or SystemExit.
        
        Since this class uses native win32event objects, the interval
        argument is ignored.
        """
        if isinstance(state, (tuple, list)):
            # Don't wait for an event that beat us to the punch ;)
            if self.state not in state:
                events = tuple([self._get_state_event(s) for s in state])
                win32event.WaitForMultipleObjects(events, 0, win32event.INFINITE)
        else:
            # Don't wait for an event that beat us to the punch ;)
            if self.state != state:
                event = self._get_state_event(state)
                win32event.WaitForSingleObject(event, win32event.INFINITE) 
开发者ID:binhex,项目名称:moviegrabber,代码行数:18,代码来源:win32.py

示例6: Transmit

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def Transmit(self, transmitData):
        """
        This will be called to detect available IR Blasters.
        """
        if not self.file:
            if not self.connecting:
                self.Connect()
            else:
                return False
        while self.receiving:
            time.sleep(0.05)
        writeOvlap = win32file.OVERLAPPED()
        writeOvlap.hEvent = win32event.CreateEvent(None, 0, 0, None)
        win32file.WriteFile(self.file, transmitData, writeOvlap)
        win32event.WaitForSingleObject(writeOvlap.hEvent, win32event.INFINITE)
        return True 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:18,代码来源:__init__.py

示例7: __windows_init__

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def __windows_init__(self):
        import win32event
        semaphore_all_access = 0x1F0003

        self.timeout = 5000 if self.should_timeout else win32event.INFINITE            

        self._semaphore1 = \
            win32event.OpenSemaphore(semaphore_all_access, False,
                                     "Global\\HOLODECK_SEMAPHORE_SERVER" + self._uuid)
        self._semaphore2 = \
            win32event.OpenSemaphore(semaphore_all_access, False,
                                     "Global\\HOLODECK_SEMAPHORE_CLIENT" + self._uuid)

        def windows_acquire_semaphore(sem):
            result = win32event.WaitForSingleObject(sem, self.timeout)

            if result != win32event.WAIT_OBJECT_0:
                raise TimeoutError("Timed out or error waiting for engine!")
            
        def windows_release_semaphore(sem):
            win32event.ReleaseSemaphore(sem, 1)

        def windows_unlink():
            pass

        self._get_semaphore_fn = windows_acquire_semaphore
        self._release_semaphore_fn = windows_release_semaphore
        self.unlink = windows_unlink 
开发者ID:BYU-PCCL,项目名称:holodeck,代码行数:30,代码来源:holodeckclient.py

示例8: wait

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def wait(self):
            """Wait for child process to terminate.  Returns returncode
            attribute."""
            if self.returncode == None:
                obj = WaitForSingleObject(self._handle, INFINITE)
                self.returncode = GetExitCodeProcess(self._handle)
                _active.remove(self)
            return self.returncode 
开发者ID:linuxscout,项目名称:mishkal,代码行数:10,代码来源:subprocess24.py

示例9: transmit

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def transmit(self,dataToTransmit):
        
        # convert to string
        dataToTransmit  = ''.join([chr(b) for b in dataToTransmit])
        
        # write over tuntap interface
        win32file.WriteFile(self.tuntap, dataToTransmit, self.overlappedTx)
        win32event.WaitForSingleObject(self.overlappedTx.hEvent, win32event.INFINITE)
        self.overlappedTx.Offset = self.overlappedTx.Offset + len(dataToTransmit)
    
    #======================== private ========================================= 
开发者ID:alexsunday,项目名称:pyvpn,代码行数:13,代码来源:tun-ping-responder.py

示例10: run

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def run(self):
        self.running = True
        while self.running:
            errCode, bytes, key, overlapped = \
                GetQueuedCompletionStatus(self.io_req_port, INFINITE)
            if key == ISAPI_SHUTDOWN and overlapped is None:
                break

            # Let the parent extension handle the command.
            dispatcher = self.extension.dispatch_map.get(key)
            if dispatcher is None:
                raise RuntimeError("Bad request '%s'" % (key,))
            
            dispatcher(errCode, bytes, key, overlapped) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:16,代码来源:threaded_extension.py

示例11: SvcDoRun

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def SvcDoRun(self):
        # do nothing at all - just wait to be stopped
        win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE)
        # Write a stop message.
        servicemanager.LogMsg(
                servicemanager.EVENTLOG_INFORMATION_TYPE,
                servicemanager.PYS_SERVICE_STOPPED,
                (self._svc_name_, '')
                ) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:serviceEvents.py

示例12: join

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def join(self):
        win32event.WaitForSingleObject(self.processHandle,
                                       win32event.INFINITE)
        self.exitCode = win32process.GetExitCodeProcess(self.processHandle) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:6,代码来源:test_win32trace.py

示例13: testSimpleOverlapped

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def testSimpleOverlapped(self):
        # Create a file in the %TEMP% directory.
        import win32event
        testName = os.path.join( win32api.GetTempPath(), "win32filetest.dat" )
        desiredAccess = win32file.GENERIC_WRITE
        overlapped = pywintypes.OVERLAPPED()
        evt = win32event.CreateEvent(None, 0, 0, None)
        overlapped.hEvent = evt
        # Create the file and write shit-loads of data to it.
        h = win32file.CreateFile( testName, desiredAccess, 0, None, win32file.CREATE_ALWAYS, 0, 0)
        chunk_data = str2bytes("z") * 0x8000
        num_loops = 512
        expected_size = num_loops * len(chunk_data)
        for i in range(num_loops):
            win32file.WriteFile(h, chunk_data, overlapped)
            win32event.WaitForSingleObject(overlapped.hEvent, win32event.INFINITE)
            overlapped.Offset = overlapped.Offset + len(chunk_data)
        h.Close()
        # Now read the data back overlapped
        overlapped = pywintypes.OVERLAPPED()
        evt = win32event.CreateEvent(None, 0, 0, None)
        overlapped.hEvent = evt
        desiredAccess = win32file.GENERIC_READ
        h = win32file.CreateFile( testName, desiredAccess, 0, None, win32file.OPEN_EXISTING, 0, 0)
        buffer = win32file.AllocateReadBuffer(0xFFFF)
        while 1:
            try:
                hr, data = win32file.ReadFile(h, buffer, overlapped)
                win32event.WaitForSingleObject(overlapped.hEvent, win32event.INFINITE)
                overlapped.Offset = overlapped.Offset + len(data)
                if not data is buffer:
                    self.fail("Unexpected result from ReadFile - should be the same buffer we passed it")
            except win32api.error:
                break
        h.Close() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:37,代码来源:test_win32file.py

示例14: testCompletionPortsQueued

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def testCompletionPortsQueued(self):
        class Foo: pass
        io_req_port = win32file.CreateIoCompletionPort(-1, None, 0, 0)
        overlapped = pywintypes.OVERLAPPED()
        overlapped.object = Foo()
        win32file.PostQueuedCompletionStatus(io_req_port, 0, 99, overlapped)
        errCode, bytes, key, overlapped = \
                win32file.GetQueuedCompletionStatus(io_req_port, win32event.INFINITE)
        self.failUnlessEqual(errCode, 0)
        self.failUnless(isinstance(overlapped.object, Foo)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:test_win32file.py

示例15: wait

# 需要导入模块: import win32event [as 别名]
# 或者: from win32event import INFINITE [as 别名]
def wait(self):
            """Wait for child process to terminate.  Returns returncode
            attribute."""
            if self.returncode is None:
                obj = WaitForSingleObject(self._handle, INFINITE)
                self.returncode = GetExitCodeProcess(self._handle)
            return self.returncode 
开发者ID:bq,项目名称:web2board,代码行数:9,代码来源:_scons_subprocess.py


注:本文中的win32event.INFINITE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。