event-loop

QEventLoop: get time when an event was scheduled

丶灬走出姿态 提交于 2019-12-01 12:12:52
Is it possible to get the time when an event has been scheduled to a QEventLoop (e.g. the QCoreApplication event loop)? I have a situation where the main event loop is paused. When it's reactivated the events are fired and I am interested in the time when the events where added to the queue. The events are not custom events but system (and other) events. Regards, It mainly depends on what are the system events you are interested in, for you have already the timestamp in some cases. As an example, QInputEvent ( base class for events that describe user input , like QMouseEvent , QKeyEvent , and

QEventLoop: get time when an event was scheduled

百般思念 提交于 2019-12-01 11:20:02
问题 Is it possible to get the time when an event has been scheduled to a QEventLoop (e.g. the QCoreApplication event loop)? I have a situation where the main event loop is paused. When it's reactivated the events are fired and I am interested in the time when the events where added to the queue. The events are not custom events but system (and other) events. Regards, 回答1: It mainly depends on what are the system events you are interested in, for you have already the timestamp in some cases. As an

Eclipse Unhandled event loop exception, no more handles Windows 7

我只是一个虾纸丫 提交于 2019-12-01 03:31:33
My Eclipse is used to develop Android Apps. It worked fine until one day, a Unhandled event loop exception is prompt. The log is shown below. To trigger the error prompt, just unfocus the text editor in eclipse and focus it again, then the prompt is triggered, For example, click on the Package explorer (Red circle) and click on the code (Green circle) in Main.java in Eclipse. (.xml are the same). But, if I unfocus the code by clicking Package Explorer (Red circle) then click on the title of the code (Blue circle) and then click on the code (Green circle), the error will not be prompted. P.S.

Event loop implementation for Python 3?

你说的曾经没有我的故事 提交于 2019-12-01 00:41:52
Does anyone know of an event loop library (or bindings) available for Python 3? It's okay if it only does UNIX systems, though I would prefer something that does Windows as well. ETA : I realize that it is not terribly difficult to write an event loop system. However, I don't want to reinvent the wheel (we are still encouraging not doing so these days, right? ;-)) This is planned for a server application, so obviously I'd want something that isn't tied to a GUI widget toolkit or something. If the answer is "Nope, there isn't one" (probably; I sure as heck can't find one) then I will most

A way to make keyboard event queue both responsive and not take whole CPU power

时间秒杀一切 提交于 2019-11-30 22:15:49
I am making an Sdl game, it's 2d shooter. I am using SDL to import surfaces and OpenGL to draw them on the screen (doing so because it works way faster than just SDL). I've got two threads running, one for processing stuff and rendering, and another one for input. Basically, the processing one is taking 1-2% of my CPU, while the input loop takes 25% (on quad-core, so it's 1 full core). I tried doing SDL_Delay(1) before each while (SDL_PollEvent(&keyevent)) and it works! Reduces CPU load to 3% for whole process. However, there's a nasty side effect. The whole program input is handicapped: it

Does V8 have an event loop?

孤人 提交于 2019-11-30 21:45:11
I keep hearing V8 has its rudimentary event loop implementation but couldn't find it doesn't really make sense to me. Methinks, the simplest design of a JS engine would be to simply run synchronously and let the "embedder" write their own event loop - like nodejs got libuv. Is there an event loop implementation in v8? If so, could you point me at it? Your intuition is right that the event loop is something that embedders should have control over. However, it is also a fundamental abstract concept of the JavaScript programming model. V8's solution is to provide a default implementation that

Exception “ There is no current event loop in thread 'MainThread' ” while running over new loop

浪子不回头ぞ 提交于 2019-11-30 20:59:30
The is the simple test code and the result. import asyncio async def test(): await asyncio.sleep(1) if __name__ == '__main__': asyncio.set_event_loop(None) # Clear the main loop. loop = asyncio.new_event_loop() # Create a new loop. loop.run_until_complete(test()) # Run coroutine over the new loop Traceback (most recent call last): File "test_test.py", line 11, in <module> loop.run_until_complete(test()) File "/usr/lib/python3.5/asyncio/base_events.py", line 387, in run_until_complete return future.result() File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result raise self._exception

A way to make keyboard event queue both responsive and not take whole CPU power

寵の児 提交于 2019-11-30 17:28:03
问题 I am making an Sdl game, it's 2d shooter. I am using SDL to import surfaces and OpenGL to draw them on the screen (doing so because it works way faster than just SDL). I've got two threads running, one for processing stuff and rendering, and another one for input. Basically, the processing one is taking 1-2% of my CPU, while the input loop takes 25% (on quad-core, so it's 1 full core). I tried doing SDL_Delay(1) before each while (SDL_PollEvent(&keyevent)) and it works! Reduces CPU load to 3%

What is an event loop in Qt?

随声附和 提交于 2019-11-30 16:48:30
I have understood the following regarding QApplication's exec function: QApplication exec starts the main event loop. It launches the GUI. It processes the signals and calls appropriate slots on receiving them. It waits until exit is called and returns the value which was set in exit. Now, when we say event loop, does it mean that there is some while loop running in the internal code of Qt, and in that while loop the method of handling signals and slots is written? Now, when we say event loop, does it mean that there is some while loop running in the internal code of Qt, and in that while loop

How does Python's Twisted Reactor work?

不问归期 提交于 2019-11-30 11:07:31
Recently, I've been diving into the Twisted docs. From what I gathered, the basis of Twisted's functionality is the result of it's event loop called the "Reactor". The reactor listens for certain events and dispatches them to registered callback functions that have been designed to handle these events. In the book, there is some pseudo code describing what the Reactor does but I'm having trouble understanding it, it just doesn't make any sense to me. while True: timeout = time_until_next_timed_event() events = wait_for_events(timeout) events += timed_events_until(now()) for event in events: