Fedora meeting Mono Half-Way

Dan Williams dcbw at redhat.com
Thu Dec 15 17:46:19 UTC 2005


On Thu, 2005-12-15 at 12:27 -0500, Paul A Houle wrote:
> just do 20% of the work and say it's done.  Python has the same thread 
> safety problems as PHP and Perl (it links in who knows how many unsafe 
> libraries) but the Python people tell you to jump right in and use 
> threads,  whereas the PHP and Perl people warn about the dangers.  In 

The Fedora Extras build system is written in Python, from the server to
client to the web interface.  It makes _heavy_ use of threads.  The
hardest problem in Python with threads is making sure all your python
imports are threadsafe.  pyOpenSSL was not threadsafe when I began
plague, but fixing that issue was simple even if the diagnosis was long
& arduous.  Now that pyOpenSSL threading is OK, the build system code
works fine.

The point here being that Python's thread safety and behavior when
running 10s or even 100s of threads is actually quite good in base
Python (since 2.4).  Since python pretty much just uses libraries that
are on the system anyway (eg libxml, OpenSSL, etc), you'd have have to
make those libraries thread-safe or protect your usage of them if you
used C/C++ anyway.  It's not a problem specific to Python or Perl or
PHP.

GUI apps don't count, because almost all toolkits (win32, Cocoa/Carbon,
GTK+) are explicitly _not_ threadsafe, though they may be thread-aware
and contain workarounds for threading.  You can't, for example, run
Cocoa GUI code from the thread that doesn't own the Cocoa event loop.
Same thing for GTK+; you shouldn't modify widgets from a different
thread than the mainloop is running in.  That's why there's so much
focus on MVC and messages; separate the View from the data model, and
you're fine.

Dan





More information about the fedora-devel-list mailing list