Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Nov 2000 01:23:10 +0100
From:      Bradley T.Hughes <bhughes@trolltech.com>
To:        freebsd-stable@freebsd.org
Subject:   pthreads implementation on 4.2-RELEASE
Message-ID:  <00112501231000.63250@reticent.troll.no>

next in thread | raw e-mail | index | archive | help

--------------Boundary-00=_M21KDOZ62Z1NZQIHW23T
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

Recursive mutexes on 4.2-RELEASE are completely broken.  see the attached 
program (gcc -pthread -o blah blah.c)

-- 
--
Bradley T. Hughes <bhughes@trolltech.com>
Trolltech AS - Waldemar Thranes gt. 98B N-0175 Oslo, Norway
Office: +47 21604892
Mobile: +47 92019781

--------------Boundary-00=_M21KDOZ62Z1NZQIHW23T
Content-Type: text/x-c++;
  name="blah.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="blah.c"

I2luY2x1ZGUgPHB0aHJlYWQuaD4KI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcu
aD4KI2luY2x1ZGUgPHVuaXN0ZC5oPgoKcHRocmVhZF9jb25kX3QgY29uZDsKCnZvaWQgKnRocmVh
ZDEodm9pZCAqYXJnKSB7CiAgICBwdGhyZWFkX211dGV4X3QgKm11dGV4ID0gKHB0aHJlYWRfbXV0
ZXhfdCAqKSBhcmc7CgogICAgLy8gbG9jay91bmxvY2sgb25jZSB3b3JrcyBmaW5lCiAgICBwcmlu
dGYoInRocmVhZCAxIGxvY2tpbmcgbXV0ZXggKCVzKVxuIiwKICAgICAgICAgICBzdHJlcnJvcihw
dGhyZWFkX211dGV4X2xvY2sobXV0ZXgpKSk7CiAgICAKICAgIC8vIG1ha2Ugc3VyZSB0aHJlYWQx
IGlzIGZpcnN0CiAgICBwdGhyZWFkX2NvbmRfd2FpdCgmY29uZCwgbXV0ZXgpOwogICAgcHRocmVh
ZF9jb25kX3NpZ25hbCgmY29uZCk7CiAgICAKICAgIHBya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gIHByaW50ZigidGhyZWFkIDEgdW5sb2NraW5nIG11dGV4IDYgKCVzKVxuIiwK
ICAgICAgICAgICBzdHJlcnJvcihwdGhyZWFkX211dGV4X3VubG9jayhtdXRleCkpKTsKCiAgICBw
cmludGYoInRocmVhZCAxIGxvY2tpbmcgbXV0ZXggNiAoJXMpXG4iLAogICAgICAgICAgIHN0cmVy
cm9yKHB0aHJlYWRfbXV0ZXhfbG9jayhtdXRleCkpKTsKICAgIHNsZWVwKDEpOwoKICAgIHByaW50
ZigidGhyZWFkIDEgdW5sb2NraW5nIG11dGV4IDYgKCVzKVxuIiwKICAgICAgICAgICBzdHJlcnJv
cihwdGhyZWFkX211dGV4X3VubG9jayhtdXRleCkpKTsKCiAgICAgc2xlZXAoMSk7CgogICAgCiAg
ICAvLyBsb2NrIDYgdGltZXMgYW5kIHRoZW4gdW5sb2NrIDYgdGltZXMKICAgIHByaW50ZigidGhy
ZWFkIDEgbG9ja2luZyBtdXRleCAxICglcylcbiIsCiAgICAgICAgICAgc3RyZXJyb3IocHRocmVh
ZF9tdXRleF9sb2NrKG11dGV4KSkpOwogICAgcHJpbnRmKCJ0aHJlYWQgMSBsb2NraW5nIG11dGV4
IDIgKCVzKVxuIiwKICAgICAgICAgICBzdHJlcnJvcihwdGhyZWFkX211dGV4X2xvY2sobXV0ZXgp
KSk7CiAgICBwcmludGYoInRocmVhZCAxIGxvY2tpbmcgbXV0ZXggMyAoJXMpXG4iLAogICAgICAg
ICAgIHN0cmVycm9yKHB0aHJlYWRfbXV0ZXhfbG9jayhtdXRleCkpKTsKICAgIHByaW50ZigidGhy
ZWFkIDEgbG9ja2luZyBtdXRleCA0ICglcylcbiIsCiAgICAgICAgICAgc3RyZXJyb3IocHRocmVh
ZF9tdXRleF9sb2NrKG11dGV4KSkpOwogICAgcHJpbnRmKCJ0aHJlYWQgMSBsb2NraW5nIG11dGV4
IDUgKCVzKVxuIiwKICAgICAgICAgICBzdHJlcnJvcihwdGhyZWFkX211dGV4X2xvY2sobXV0ZXgp
KSk7CiAgICBwcmludGYoInRocmVhZCAxIGxvY2tpbmcgbXV0ZXggNiAoJXMpXG4iLAogICAgICAg
ICAgIHN0cmVycm9yKHB0aHJlYWRfbXV0ZXhfbG9jayhtdXRleCkpKTsKCiAgICBwcmludGYoInRo
cmVhZCAxIHVubG9ja2luZyBtdXRleCA2ICglcylcbiIsCiAgICAgICAgICAgc3RyZXJyb3IocHRo
cmVhZF9tdXRleF91bmxvY2sobXV0ZXgpKSk7CiAgICBwcmludGYoInRocmVhZCAxIHVubG9ja2lu
ZyBtdXRleCA1ICglcylcbiIsCiAgICAgICAgICAgc3RyZXJyb3IocHRocmVhZF9tdXRleF91bmxv
Y2sobXV0ZXgpKSk7CiAgICBwcmludGYoInRocmVhZCAxIHVubG9ja2luZyBtdXRleCA0ICglcylc
biIsCiAgICAgICAgICAgc3RyZXJyb3IocHRocmVhZF9tdXRleF91bmxvY2sobXV0ZXgpKSk7CiAg
ICBwcmludGYoInRocmVhZCAxIHVubG9ja2luZyBtdXRleCAzICglcylcbiIsCiAgICAgICAgICAg
c3RyZXJyb3IocHRocmVhZF9tdXRleF91bmxvY2sobXV0ZXgpKSk7CiAgICBwcmludGYoInRocmVh
ZCAxIHVubG9ja2luZyBtdXRleCAyICglcylcbiIsCiAgICAgICAgICAgc3RyZXJyb3IocHRocmVh
ZF9tdXRleF91bmxvY2sobXV0ZXgpKSk7CiAgICAKICAgIHByaW50ZigiISEhIHNob3VsZCBzdGls
bCBiZSBsb2NrZWQsIGJ1dCB0aGUgb3RoZXIgdGhyZWFkIHdpbGwgYmUgYWJsZSB0byBydW4gbm93
XG4iKTsKICAgIHNsZWVwKDEpOwogICAgcHJpbnRmKCJ0aHJlYWQgMSB1bmxvY2tpbmcgbXV0ZXgg
MSAoJXMpXG4iLAogICAgICAgICAgIHN0cmVycm9yKHB0aHJlYWRfbXV0ZXhfdW5sb2NrKG11dGV4
KSkpOwogICAgcHJpbnRmKCIhISEgbm90aWNlIHRoZS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wdGhyZWFkX211dGV4X2xvY2sobXV0ZXgpKSk7CiAgICBwcmludGYoInRocmVhZCAyIGxvY2tp
bmcgbXV0ZXggNiAoJXMpXG4iLAogICAgICAgICAgIHN0cmVycm9yKHB0aHJlYWRfbXV0ZXhfbG9j
ayhtdXRleCkpKTsKCiAgICBwcmludGYoInRocmVhZCAyIHVubG9ja2luZyBtdXRleCA2ICglcylc
biIsCiAgICAgICAgICAgc3RyZXJyb3IocHRocmVhZF9tdXRleF91bmxvY2sobXV0ZXgpKSk7CiAg
ICBwcmludGYoInRocmVhZCAyIHVubG9ja2luZyBtdXRleCA1ICglcylcbiIsCiAgICAgICAgICAg
c3RyZXJyb3IocHRocmVhZF9tdXRleF91bmxvY2sobXV0ZXgpKSk7CiAgICBwcmludGYoInRocmVh
ZCAyIHVubG9ja2luZyBtdXRleCA0ICglcylcbiIsCiAgICAgICAgICAgc3RyZXJyb3IocHRocmVh
ZF9tdXRleF91bmxvY2sobXV0ZXgpKSk7CiAgICBwcmludGYoInRocmVhZCAyIHVubG9ja2luZyBt
dXRleCAzICglcylcbiIsCiAgICAgICAgICAgc3RyZXJyb3IocHRocmVhZF9tdXRleF91bmxvY2so
bXV0ZXgpKSk7CiAgICBwcmludGYoInRocmVhZCAyIHVubG9ja2luZyBtdXRleCAyICglcylcbiIs
CiAgICAgICAgICAgc3RyZXJyb3IocHRocmVhZF9tdXRleF91bmxvY2sobXV0ZXgpKSk7CgogICAg
Ly8gc2hvdWxkIGJlIGxvY2tlZCwgYnV0IGl0IGlzIG5vdAogICAgcHJpbnRmKCJ0aHJlYWQgMiB1
bmxvY2tpbmcgbXV0ZXggMSAoJXMpXG4iLAogICAgICAgICAgIHN0cmVycm9yKHB0aHJlYWRfbXV0
ZXhfdW5sb2NrKG11dGV4KSkpOwoKICAgIHJldHVybiBOVUxMOwp9CgoKaW50IG1haW4oKSB7CiAg
ICBwdGhyZWFkX3QgdGhyMSwgdGhyMjsKICAgIHB0aHJlYWRfbXV0ZXhfdCBtdXRleDsKICAgIHZv
aWQgKmp1bms7CgogICAgcHRocmVhZF9tdXRleGF0dHJfdCBtYXR0cjsKICAgIHB0aHJlYWRfbXV0
ZXhhdHRyX2luaXQoJm1hdHRyKTsKICAgIHB0aHJlYWRfbXV0ZXhhdHRyX3NldHR5cGUoJm1hdHRy
LCBQVEhSRUFEX01VVEVYX1JFQ1VSU0lWRSk7CiAgICBwdGhyZWFkX211dGV4X2luaXQoJm11dGV4
LCAmbWF0dHIpOwoKICAgIHB0aHJlYWRfY29uZF9pbml0KCZjb25kLCBOVUxMKTsKCiAgICBwdGhy
ZWFkX2NyZWF0ZSggJnRocjEsIE5VTEwsIHRocmVhZDEsICh2b2lkICopICZtdXRleCApOwogICAg
cHRocmVhZF9jcmVhdGUoICZ0aHIyLCBOVUxMLCB0aHJlYWQyLCAodm9pZCAqKSAmbXV0ZXggKTsK
CiAgICBwdGhyZWFkX2pvaW4odGhyMSwgJmp1bmspOwogICAgcHRocmVhZF9qb2luKHRocjIsICZq
dW5rKTsKCiAgICByZXR1cm4gMDsKfQo=

--------------Boundary-00=_M21KDOZ62Z1NZQIHW23T--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00112501231000.63250>