schemeunit: How best to discover exceptions in child threads?

Eric Hanchrow <[email protected]> Thu, 16 Aug 2007 12:48:15 -0700
Newsgroups gmane.lisp.scheme.plt.schematics
Message-ID <[email protected]>
--=-=-=

Here's a problem which I've already solved, but I'm not in love with
the solution, and am wondering if there's a better way.

I have some functions that create threads, and sometimes those threads
raise uncaught exceptions.  And sometimes, alas, my tests don't notice
(because the dead thread didn't directly contribute to the result my
tests are looking for).  And sometimes I don't notice the exception,
since its only evidence is a few lines of output, which tend to get
lost amongst all the other output.

So I'd like a way for the tests to fail when a child thread raises an
uncaught exception.  Attached is the way I've found to do it, but it
just seems clunky.  Can someone suggest a better way?

--=-=-=
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=thread-trouble.ss
Content-Transfer-Encoding: base64
Content-Description: thread-trouble.ss

IyEgL2Jpbi9zaAojfCBIZXkgRW1hY3MsIHRoaXMgaXMgLSotc2NoZW1lLSotIGNvZGUhCiMkSWQ6
IHRocmVhZC10cm91YmxlLnNzIDQ3NDAgMjAwNy0wOC0xNiAxOTozNDoyM1ogZXJpY2ggJApleGVj
IG16c2NoZW1lIC1NIGVycm9ydHJhY2UgLS1uby1pbml0LWZpbGUgLS1tdXRlLWJhbm5lciAtLXZl
cnNpb24gLS1yZXF1aXJlICIkMCIgIC1lICIobWFpbikiCnwjCihtb2R1bGUgdGhyZWFkLXRyb3Vi
bGUgbXpzY2hlbWUKKHJlcXVpcmUgKGxpYiAidHJhY2Uuc3MiKQogICAgICAgICAocGxhbmV0ICJ0
ZXN0LnNzIiAgICAoInNjaGVtYXRpY3MiICJzY2hlbWV1bml0LnBsdCIgMikpCiAgICAgICAgIChw
bGFuZXQgInV0aWwuc3MiICAgICgic2NoZW1hdGljcyIgInNjaGVtZXVuaXQucGx0IiAyKSkKICAg
ICAgICAgKHBsYW5ldCAidGV4dC11aS5zcyIgKCJzY2hlbWF0aWNzIiAic2NoZW1ldW5pdC5wbHQi
KSkKICAgICAgICAgKQoKOzsgQW4gZXhhbXBsZSBvZiBhIHByb2JsZW0gdGhhdCBJIGRvbid0IGtu
b3cgaG93IHRvIHdvcmsgYXJvdW5kIC0tCjs7IHdoZW4gYSB0aHJlYWQgZGllcyBkdXJpbmcgYSB0
ZXN0LCB0aGUgdGVzdCBzdGlsbCBwYXNzZXMuCgooZGVmaW5lIChjb21wbGV4LWJ1Z2d5LWZ1bmN0
aW9uKQogICh0aHJlYWQKICAgKGxhbWJkYSAoKQogICAgIChjYXIgJ2ZvbykpKSkKCihkZWZpbmUg
KGhhcmQtd29ya2luZy1mdW5jdGlvbikKICAoY29tcGxleC1idWdneS1mdW5jdGlvbikKICAoc2xl
ZXAgMS8yKQogIDYpCgoMCihkZWZpbmUgZXhjZXB0aW9uLWluLWNoaWxkLXRocmVhZD8gI2YpCgoo
ZGVmaW5lIHRocmVhZC10cm91YmxlLXRlc3RzCgogICh0ZXN0LXN1aXRlCiAgICJ0aHJlYWQtdHJv
dWJsZSIKICAgKHRlc3QtZXF1YWw/CiAgICAieW93IgogICAgKGhhcmQtd29ya2luZy1mdW5jdGlv
bikgNikKICAgKHRlc3QtZmFsc2UgIk5vIGV4Y2VwdGlvbnMiCiAgICAgICAgICAgICAgIGV4Y2Vw
dGlvbi1pbi1jaGlsZC10aHJlYWQ/KSkpCgoocHJvdmlkZSAoYWxsLWRlZmluZWQpKQooZGVmaW5l
IChtYWluKQogIChwYXJhbWV0ZXJpemUgKCh1bmNhdWdodC1leGNlcHRpb24taGFuZGxlcgogICAg
ICAgICAgICAgICAgICAobGFtYmRhIGFyZ3MKICAgICAgICAgICAgICAgICAgICAoc2V0ISBleGNl
cHRpb24taW4tY2hpbGQtdGhyZWFkPyBhcmdzKQogICAgICAgICAgICAgICAgICAgICkpKQogICAg
KGV4aXQgKHRlc3QvdGV4dC11aSB0aHJlYWQtdHJvdWJsZS10ZXN0cyAndmVyYm9zZSkpKSkKKQo=
--=-=-=


-- 
A bad analogy is like a leaky screwdriver.
        -- Richard Braakman

--=-=-=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
--=-=-=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Schematics-development mailing list
Schematics-development-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/schematics-development

--=-=-=--