Jython thread safety

Ype Kingma ykingma at accessforall.nl
Wed Dec 5 09:24:44 EST 2001


Andreas Ulbrich wrote:
> 
> Eoin Kelly wrote:
> 
> >
> >
> > Hello,
> >
> > Can anyone please tell me of references to information regarding thread
> > safety issues with jython
> >
> > Thank in adv,
> > Eoin
> >
> >
> 
> Jython safety is pretty good. I never got hurt using jython. :-) As far
> as security is concerned, well jython is 100% pure Java. Everything that
> applies to Java is valid for Jython too.

Or do you mean the use of thread synchronisation mechanisms to obtain
thread safety? In that case this might be interesting to know:
- jython threads are java threads, you can set scheduling priorities for them
  using java's thread facilities,
- jython has no central interpreter lock like cpython, it uses java's
  synchronisation mechanisms instead. If you have more than one processor,
  jython will allow you to use all of them.
- the standard thread synchronisation classes Queue, Lock, Event, Semaphore etc.
  are part of the jython distribution,
- when you need faster synchronisation, you can use Doug Lea's
  util.concurrent package for java as it is:
  http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html
  It's interface is remarkably similar to the python standard synchronisation
  classes, and it has a lot more to offer.

Have fun,
Ype



More information about the Python-list mailing list