Thread-killing, round 666 (was Re: Lisp mentality vs. Python mentality)

Vsevolod vseloved at gmail.com
Mon Apr 27 05:55:18 EDT 2009


On Apr 27, 3:20 am, a... at pythoncraft.com (Aahz) wrote:
> In article <793a5176-ec2d-4ffd-b1e7-762077733... at v35g2000pro.googlegroups.com>,
>
> Vsevolod  <vselo... at gmail.com> wrote:
> >On Apr 26, 6:28 pm, a... at pythoncraft.com (Aahz) wrote:
>
> >> The problem is that thread-killing (in the literal sense) doesn't work.
> >> Unlike processes, there's no thread-environment encapsulation at the OS
> >> level, which means that things don't get cleaned up properly.  Even Java
> >> has mostly given up on thread-killing.  The only way to kill threads
> >> safely is to have them terminate themselves.  Your other option is to use
> >> multiple processes.
>
> >Well, somehow, in Lisp it's not a problem. :)
>
> Does Lisp even have OS-level threads?  What Lisp are you using, on what
> OS?  Are they perhaps Erlang-style cooperative threads instead?
> --
> Aahz (a... at pythoncraft.com)           <*>        http://www.pythoncraft.com/
>
> "If you think it's expensive to hire a professional to do the job, wait
> until you hire an amateur."  --Red Adair

Different Lisp implementations provide different solutions. SBCL
provides OS-level threads (on Linux), which I personally use, while
CMUCL offers green threads. Allegro, LispWorks, Clozure CL, Sceineer
CL and ECL as well have threading, but I don't use them, so won't
speak, which implementation of threading they have. There's a common
unification library -- bordeaux-threads -- that abstracts away
implementation specifics. It's API includes the function destroy-
thread.

As well I'd like to outline, that, IMO, your answer exhibits the
common attitude among pythonistas: everything should be done in one
true way, which is the best option (and that is how it's implemented
in the current version of the language). As of PEP-20: "There should
be one-- and preferably only one --obvious way to do it. Although that
way may not be obvious at first unless you're Dutch." And if someone
disagrees -- he just doesn't understand...

Cheers,
Vsevolod



More information about the Python-list mailing list