On 5/6/10, Yusuke ENDOH <mame / tsg.ne.jp> wrote:
> BTW, what behavior do you expect when an exception is raised
> during ConditionVariable#wait?
>
> Currently, the call to CV#wait may aborted *without* locking
> the corresponding mutex:

That sure doesn't sound good.

> This is a serious issue, but if this is fixed to ensure to lock
> the mutex by ignoring an exception, the process can not be
> stopped by Ctrl+C.  It is another serious issue.

I can't say I entirely understand. Do you mean that ignoring the 2nd
Thread#raise causes ctrl-c to be ignored? Can a special case for
ctrl-c be made? Is there a more complete discussion of this issue
somewhere?

> I guess there is no answer satisfying everbody, but I think we
> should accept the fact that Thread#raise is not in line with CV.

Yeah, since double Thread#raise is known to be buggy (and unfixable?)
then there may not be much that can be done..... :-\

> In addition, if we are really serious for using CV, signal must
> not be converted to an exception, such as SIGINT and Interrupted.
> It can be achieved by Kernel#trap, i.e., trap(:INT) {}, but it
> is too stoic to enjoy programming...

All signals are sent to the main thread, aren't they? So at least the
user needs to worry about this only if using a CV in the main thread.

But, yeah, it's yucky. I hate condition variables.

>> Am I the only one who likes semaphores? Silvain, I'm particularly
>> interested in hearing your opinion. Would a semaphore have suited your
>> purposes as well as a condvar does?
>
> Agreed.  CV is too difficult.

I'm glad you feel the same way.