[Zope] - Events, Schedulers ...

Jim Fulton jim.fulton@Digicool.com
Thu, 10 Dec 1998 10:07:29 -0500


Pavlos Christoforou wrote:
> 
> I am thinking of implementing some kind of event loop in my bobo app
> (maybe in Zope too) but ...
> I don't know much about threads or signals.
> 
> Do win NT/95 support some simple signals like alarm?
> 
> I understand that having the eventloop running in a different thread can
> be disastrous, since a function registered in the eventloop might fight
> for the same resources as a function running in the main loop.

This does have to be handled carefully.  It will become much easier
in Zope 2 (with the thing formerly known as BoboPOS3), but it is 
reasonably straightforward now.

The way we've done this in the past is to define an application lock
and set the acquire and release methods of the lock to 
__bobo_before__ and __bobo_after__ in the published module
(Main in the Zope Framework), so that they get called by 
Bobo^H^H^H^HZPublisher when it handles a request.  Then, when 
the scheduler needs to access application objects, it acquires 
the application lock with __bobo_before__ and releases it with 
__bobo_after__, just like ZPublisher does.  You can see remnants 
of this in the (mostly defunct) scheduler package.

As I mentioned above, the thing FKA BoboPOS3 will make this much easier.
In fact, it will eliminate the need for an application lock!

Jim


--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (888) 344-4332              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.