asynchronous callbacks

Duncan Grisby duncan-news at grisby.org
Tue May 28 10:29:43 EDT 2002


In article <dae4590e.0205231025.7cbb29af at posting.google.com>,
 hans <hans.geuns at scansoft.com> wrote:

>I'm writing a Python extension module that has to handle asynchronous
>callbacks.  There have been some earlier posts about this, but so far
>I haven't found a safe solution.

omniORBpy has to do exactly this. When I first wrote it, I created a
new Python thread state on every call, but I discovered that that
imposes a huge overhead. I implemented a cache of thread states, which
halved the invocation time.

The code is in C++, but reading it might help you figure out something
useful to you. Look at pyThreadCache.h and pyThreadCache.cc in this
CVS directory:

  http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/omniorb/omniORBpy/modules/?only_with_tag=omnipy2_develop

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the Python-list mailing list