Subj : Re: I write a multithread program with pthread, and meet a program To : comp.programming.threads From : Giancarlo Niccolai Date : Wed Apr 20 2005 11:13 am David Butenhof wrote: > That is, they may intend that you disable > cancelability around any area of code that might do this; and while you > can argue which makes most sense there's no objective authority to say > they're wrong. Well, I never stated about correctness of one or the other possible solution. I just stated that as long as cout uses write(), and unless c++ makes a future statement about the contrary, cout will be a cancellation point. Assuming that cout absolutely uses write() is arbitrary, and probably should not be taken for granted; what I meant is just that IF cout uses write(), and if C++ standard doesn't specify for the contrary, then cout will be a cancellation point. Since, at least atm, on posix compliant systems using write() seems the most reasonable way to implement cout, then I would suggest to prepare c++ code to prevent the case in which, if cout is a cancellation point, the program misbehaves. That is, cout must not be taken for a sure cancellation point (i.e. you should add your own cancellation point anyhow, or avoid using cout if you wish to be cancelled while writing), yet is higly advisable to prevent a program to fail in case it is via cancellation disabling or cleanup setting. Hope my point makes sense... Best regards, Giancarlo Niccolai .