Issue539990
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2002-04-05 21:29 by pclaerhout, last changed 2022-04-10 16:05 by admin. This issue is now closed.
Messages (13) | |||
---|---|---|---|
msg10189 - (view) | Author: Pieter Claerhout (pclaerhout) | Date: 2002-04-05 21:29 | |
I tried to use the threading module to start the XML RPC server in a different thread (xmlrpcServer itself also is a threaded piece of code), but that seems to conflict with the mainloop. If you start this application, it starts the thread, starts the mainloop and stays in there, once you finish the mainloop, the thread continues. You've stumbled on a bug in Framework.mainloop(): it doesn't know anything about multiple threads. It gives time to other applications (by calling WaitNextEvent) but not to other threads within Python. Also see http://mail.python.org/pipermail/pythonmac-sig/2002- April/005416.html and http://mail.python.org/pipermail/pythonmac-sig/2002- April/005428.html |
|||
msg10190 - (view) | Author: Jack Jansen (jackjansen) * ![]() |
Date: 2002-04-07 21:26 | |
Logged In: YES user_id=45365 Adding an optional time.sleep(0) to the mainloop should do the trick, but unfortunately this won't work with the current MacPython, as time.sleep() is implemented with select(). And while GUSI sleep(0) does the threadswitch sleect(..., 0) doesn't. So this needs to be fixed in timemodule, and then the thread switch can be forced in Framework.Application.mainloop(). |
|||
msg10191 - (view) | Author: Jack Jansen (jackjansen) * ![]() |
Date: 2002-04-22 14:03 | |
Logged In: YES user_id=45365 After some discussion on the SIG it turns out this is a rather complicated problem, because WNE() may cause callbacks to be called (for Carbon Event handlers, for instance), and releasing the GIL would mean those callbacks would be hosed. A solution will have to have all callback wrappers acquire the GIL, and it will either have to make very sure we never enter WNE() or friends with the GIL held, or the callback code will need to be able to handle both the case of being called with the GIL held and the case of being called without it. |
|||
msg10192 - (view) | Author: Jack Jansen (jackjansen) * ![]() |
Date: 2003-02-24 16:45 | |
Logged In: YES user_id=45365 Let's admit this isn't going to be fixed unless someone wants it real bad. Pieter: if you want it real bad then reopen the bug and I'll find time for it. |
|||
msg10193 - (view) | Author: Just van Rossum (jvr) * ![]() |
Date: 2003-02-24 18:51 | |
Logged In: YES user_id=92689 Jack, have you forgotten about autoGIL? It's quite likely that the autoGIL module (as part of the PyObjC project) would fix this issue out of the box on OSX. Do "import autoGIL; autoGIL.installAutoGIL()" before you enter the event loop and the second thread gets time to run. |
|||
msg10194 - (view) | Author: Jack Jansen (jackjansen) * ![]() |
Date: 2003-02-25 10:43 | |
Logged In: YES user_id=45365 If that is true I would be very happy. Could you please investigate this and put it in if it works? Before 2.3b1 please: I don't want to mess with the core of the MacOS support modules after that... |
|||
msg10195 - (view) | Author: Jurjen N.E. Bos (jneb) * | Date: 2003-04-25 09:35 | |
Logged In: YES user_id=446428 Probably fixing this will also allow to run a long computation and still use the IDE for writing other code, or run commands in interactive mode. Sounds like a cool feature! |
|||
msg10196 - (view) | Author: Just van Rossum (jvr) * ![]() |
Date: 2003-05-02 18:28 | |
Logged In: YES user_id=92689 I finally got around playing with autoGIL in the IDE (briefly, though): it seems to work just fine! Reopeing this report. Jack, I could add autoGIL.c to the Mac tree if you want. A good experiment would be to make the PackagaManager threaded... |
|||
msg10197 - (view) | Author: Jack Jansen (jackjansen) * ![]() |
Date: 2003-05-02 20:22 | |
Logged In: YES user_id=45365 What do you mean by "add it to the mac tree"? Anyway: I would love to have this functionality, but I think it is probably prudent to do development on a branch (unless you're pretty sure of it). |
|||
msg10198 - (view) | Author: Just van Rossum (jvr) * ![]() |
Date: 2003-05-02 20:30 | |
Logged In: YES user_id=92689 Mac tree: somewhere in Mac/Modules/. It's a completely standalone module, it has no impact on the rest of the (Mac)Python source tree. PythonIDE.py would import it and call autoGIL.installAutoGIL(). You should have a look ;-) I'm playing with it now, and somehow it doesn't always quite work like I thought. Need to do more testing. It works perfectly in Cocoa apps, but not always under W/FrameWork's WaitNextEvent() loop. Don't know whether this is an inherent problem, but if so, that would be a reason to move to CarbonEvents pretty soon (assuming it _does_ work under CarbonEvt.RunApplicationEventLoop()). Hm. |
|||
msg10199 - (view) | Author: Jack Jansen (jackjansen) * ![]() |
Date: 2003-05-02 22:36 | |
Logged In: YES user_id=45365 Ok, it is now clear that I didn't look at the end result of Mark Hammonds work, I thought it needed source modifications too. If it is just a module: by all means, check it in! And please add it to setup.py too (and either also add it to genpluginmodules.py and fullbuild.py, or assign this bug to me later). |
|||
msg10200 - (view) | Author: Just van Rossum (jvr) * ![]() |
Date: 2003-05-02 22:46 | |
Logged In: YES user_id=92689 In case it wasn't clear: autoGIL is completely unrelated to Mark's work. |
|||
msg10201 - (view) | Author: Just van Rossum (jvr) * ![]() |
Date: 2003-06-20 20:38 | |
Logged In: YES user_id=92689 autoGIL is now part of MacPython and works well with Framework.py on Mach-O on OSX. It does _not_ work with the GUSI-based CFM OS9 MacPython, nor will it ever, as far as I'm concerned. Closing this as "fixed". |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:05:11 | admin | set | github: 36390 |
2002-04-05 21:29:52 | pclaerhout | create |