event loop problem

Alex Martelli aleaxit at yahoo.com
Tue Oct 24 12:10:23 EDT 2000


"Toby Dickenson" <mbel44 at dial.pipex.net> wrote in message
news:jbbbvsspe19tec72dj8stctfa6v4l90224 at 4ax.com...
> Geoff Talvola <gtalvola at nameconnector.com> wrote:
>
> >For a single-threaded Python program using ADO, there's no shared data to
worry
> >about.  And what if your program structure contains long-running
calculations
> >based on data from your ADO database?  You have to contort your
calculations to
> >insert PumpWaitingMessages() calls everywhere.  A single-threaded,
non-GUI
> >application shouldn't have to have a message loop, IMO.
>
> Threads that use apartment-model COM must have a message loop - thats
> a rule imposed by that threading model.
>
> If you dont want a message loop, there are plenty of other COM
> threading models to choose from.

"plenty"?  single-threaded is just a small variant of apartment-threaded
and still needs a message-loop; then there's multi-threaded aka
free-threaded.  That's it for COM (though I hear COM+ has added one).

And you do have to worry about your code being executed from
multiple threads if you declare yourself to COM as free-threaded...
thus, protect your data with locking, etc, etc.  At least, in
the general case.


Alex






More information about the Python-list mailing list