[Patches] GNU pth thread library support

Andy Dustman adustman@comstar.net
Wed, 3 May 2000 13:00:31 -0400 (EDT)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---187888452-1274021780-957373218=:24903
Content-Type: TEXT/PLAIN; charset=US-ASCII

This patch adds the ability for Python to use the GNU pth threading
library. pth is a non-preemptive user-space threading library. For more
information, see http://www.gnu.org/software/pth. It presently has only
been tested on Linux. And of course it's against current CVS...

Buglets: Some annoying compiler warnings about socketbits.h. The
configuration could probably be better: It may conflict if other threading
libraries (other than pthreads) are installed.

-- 
andy dustman       |     programmer/analyst     |      comstar.net, inc.
telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d
"Therefore, sweet knights, if you may doubt your strength or courage, 
come no further, for death awaits you all, with nasty, big, pointy teeth!"

I confirm that, to the best of my knowledge and belief, this
contribution is free of any claims of third parties under
copyright, patent or other rights or interests ("claims").  To
the extent that I have any such claims, I hereby grant to CNRI a
nonexclusive, irrevocable, royalty-free, worldwide license to
reproduce, distribute, perform and/or display publicly, prepare
derivative versions, and otherwise use this contribution as part
of the Python software and its related documentation, or any
derivative versions thereof, at no cost to CNRI or its licensed
users, and to authorize others to do so.

I acknowledge that CNRI may, at its sole discretion, decide
whether or not to incorporate this contribution in the Python
software and its related documentation.  I further grant CNRI
permission to use my name and other identifying information
provided to CNRI by me for use in connection with the Python
software and its related documentation. So there.

---187888452-1274021780-957373218=:24903
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="python-pth.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.10.10005031300180.24903@kenny.comstar.net>
Content-Description: 
Content-Disposition: attachment; filename="python-pth.patch"

SW5kZXg6IGNvbmZpZy5oLmluDQo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQpS
Q1MgZmlsZTogL3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RhdHVzID0gcHRo
X211dGV4X3JlbGVhc2UoICZ0aGVsb2NrLT5tdXQgKTsNCisgICAgICAgICBD
SEVDS19TVEFUVVMoInB0aF9tdXRleF9yZWxlYXNlWzFdIik7DQorIA0KKyAg
ICAgICAgIGlmICggIXN1Y2Nlc3MgJiYgd2FpdGZsYWcgKSB7DQorICAgICAg
ICAgICAgICAgICAvKiBjb250aW51ZSB0cnlpbmcgdW50aWwgd2UgZ2V0IHRo
ZSBsb2NrICovDQorIA0KKyAgICAgICAgICAgICAgICAgLyogbXV0IG11c3Qg
YmUgbG9ja2VkIGJ5IG1lIC0tIHBhcnQgb2YgdGhlIGNvbmRpdGlvbg0KKyAg
ICAgICAgICAgICAgICAgICogcHJvdG9jb2wgKi8NCisgICAgICAgICAgICAg
ICAgIHN0YXR1cyA9IHB0aF9tdXRleF9hY3F1aXJlKCAmdGhlbG9jay0+bXV0
LCAhd2FpdGZsYWcsIE5VTEwgKTsNCisgICAgICAgICAgICAgICAgIENIRUNL
X1NUQVRVUygicHRoX211dGV4X2FjcXVpcmVbMl0iKTsNCisgICAgICAgICAg
ICAgICAgIHdoaWxlICggdGhlbG9jay0+bG9ja2VkICkgew0KKyAgICAgICAg
ICAgICAgICAgICAgICAgICBzdGF0dXMgPSBwdGhfY29uZF9hd2FpdCgmdGhl
bG9jay0+bG9ja19yZWxlYXNlZCwNCisgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgJnRoZWxvY2stPm11dCwgTlVM
TCk7DQorICAgICAgICAgICAgICAgICAgICAgICAgIENIRUNLX1NUQVRVUygi
cHRoX2NvbmRfYXdhaXQiKTsNCisgICAgICAgICAgICAgICAgIH0NCisgICAg
ICAgICAgICAgICAgIHRoZWxvY2stPmxvY2tlZCA9IDE7DQorICAgICAgICAg
ICAgICAgICBzdGF0dXMgPSBwdGhfbXV0ZXhfcmVsZWFzZSggJnRoZWxvY2st
Pm11dCApOw0KKyAgICAgICAgICAgICAgICAgQ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