[Jeremy] > I noticed that one frequently executed line in the mainloop is testing > whether either the ticker has dropped to 0 or if there are > things_to_do. Would it be kosher to just drop the ticker to 0 whenever > things_to_do is set to true? Then you'd only need to check the ticker > each time through. [Guido] > I think not -- Py_AddPendingCall() is supposed to be called from > interrupts and other low-level stuff, where you don't know whose > thread state you would get. Too bad, it was a nice idea. Well ... does each tstate really need its own ticker? If that were a property of the interpreter instead ("number of ticks until it's time for this interpreter to switch threads"), shared across all threads running in that interpreter, then I bet the visible semantics would be much the same. The GIL is always held when the ticker is decremented or reset, so there's nothing non-deterministic in sharing it.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4