Suraj Kurapati wrote: > During the first time Ruby transfers control to the C program (see > relay_verilog() function below), the Kernel#at_exit method is being > invoked. During subsequent times when Ruby transfers control to the C > program, the Kernel#at_exit method is not invoked. Sorry, there is *nothing* wrong with pthread_mutex_lock and Kernel#at_exit -- I was mistaken. The real problem is that I had forgotten that Kernel#at_exit runs the blocks passed to it in *reverse* order. So I was getting behavior that seemed like pthread_mutex_lock was causing Kernel#at_exit to trigger. This is purely coincidental. Sorry for the trouble. -- Posted via http://www.ruby-forum.com/.