From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200509211432.j8LEWEX00091@zamenhof.cs.utwente.nl> To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] thread confusion In-reply-to: Your message of "Wed, 21 Sep 2005 15:53:51 +0200." <6aec7d5cd5d9af853b090abafcff13a4@lsub.org> References: <6aec7d5cd5d9af853b090abafcff13a4@lsub.org> From: Axel Belinfante Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 21 Sep 2005 16:32:13 +0200 Topicbox-Message-UUID: 8d6d494c-ead0-11e9-9d60-3106f5b1d025 > : A/The main weird thing is that after doing threadint on a thread > : (created with proccreate) which presumably is hanging in a read > : sometimes(?) the process just disappears without leaving a trace, > : even though it is packed with syslog calls > : (of which only the first part gets executed). > > Did you call threadnotify()? No, threadint() (see below) > Put a print there (the handler) to see what's going on. lots of syslog already (instead of print - does that matter?) > Also, forwarding advice Russ gave time before :-), read the alef paper > and don't use interrupts at all. Agreed. I tried to do that (not use interrupts). The problem is that in this particular thread/proc I call library routine tlsClient which may hang in a read from a pipe of which I am holding the other end (to tunnel the messages). It may happen that 'the other end' decides to give up on a TLS handshake in progress and start a new TLS handshake, in which case I have to 'clean up' my side of the handshake in progress. This is where sometimes things go wrong: it seems that just closing my end of the pipe is not sufficient to get tlsClient out of the read. That's why I tried to resort to threadint: "Threadint interrupts a thread that is blocked in a channel operation or system call" (although now the question is what it means to be interrupted) Probably I should instead investigate how/why closing (my end of) the pipe is not sufficient. Would not be surprised if I'm making mistake that's so trivial/basic that I'm just overlooking it :-( (in the mean time my piece of code/administration to deal with all this is starting to live a life of its own so just getting it right and simple would be good. back to the drawing board, I guess...) Axel.