Saturday, April 02, 2011 at 9:18 PM.

feedhoseSuite.collectDeadThreads

on collectDeadThreads () {
	<<Changes
		<<12/2/10; 4:49:41 AM by DW
			<<If a waiting thread errored, it's old waitingThreads table will still be in the system table. So periodically we sweep through and get rid of the dead threads. It doesn't happen often, we didn't see the problem until we had a logic error in one of the scripts. But it doesn't cost much to clean up. :-)
	local (adrdata = feedhosesuite.init (), adrhose, now = clock.now ());
	for adrhose in @system.temp.feedHose.server.waitingThreads {
		local (i, adrthread);
		for i = sizeof (adrhose^) downto 1 {
			adrthread = @adrhose^ [i];
			if not thread.exists (nameof (adrthread^)) {
				delete (adrthread);
				adrdata^.server.stats.ctDeadThreadCollects++;
				adrdata^.server.stats.whenLastDeadThreadCollect = now}}}};
bundle {
	collectDeadThreads ()}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.