1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 <2014> 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 <2014> 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: EPICS Python Question |
From: | Matt Newville <[email protected]> |
To: | [email protected] |
Cc: | EPICS Tech Talk <[email protected]> |
Date: | Wed, 1 Oct 2014 08:54:00 -0500 |
>> For cothread, Yes, the only way to have multiple threads is to call its own Spawn method.
Ok, this is not true. There is *nothing* about cothread which prevents
additional OS threads from being started.
The restriction is the the *first* thread to call "import cothread"
becomes special, and is the only one which can preform CA operations
(and other cooperative things). Care must be taken to avoid blocking
syscalls on this thread.
This past spring I spent some time working to eliminate the special
thread restriction to make it easier to accommodate 3rd party libraries.
The work in progress can be found here:
https://github.com/mdavidsaver/cothread/commits/master
This allows CA and other cooperative tasks in multiple OS threads. It
still isn't finalized, and any input would be greatly appreciated.
> Right, and since it's hard to update third-party libraries which
already use the original Python threading to cothreads, that was a
blocker for me.
Some other work I did was to enhance the cothreads sockets wrapper to
the point that many of the Python standard library modules now work
transparently with cothread. I've tested the http client/server and
SMTP client.
This has been merged, but not released.