hipster <hipster / xs4all.nl> writes:

> Every instance of class Object (and derivatives) can have a lock, or binary
> semaphore, associated with it. When a method is called on an object that is
> declared synchronized, or a method declared synchronized is called on an
> object, or an object lock is explicitly obtained from within a member
> method, the object becomes locked. The class or method effectively defines
> a closure within which the lock is held.

What happens if the method actually generates a closure?

   def synchronized fred
     str= "hello"
     return proc { str }
   end

   a = fred

In this case, will the lock be released when fred returns, or when the 
proc is garbage collected?

> Of course the declaration
> 
>   def synchronized foo
>   end
> 
> is equivalent to the explicit
> 
>   def foo
>     synchronize{
>     }
>   end

Possibly not, although I'm not sure. Isn't there a different between

    def foo(a, b = bar())
      synchronize {
      }
    end

and

    def synchronized  foo(a, b = bar())
    end

if bar() is itself involved in synchronization?


As 'synchronized' effectively gives us monitors, do you have any ideas 
on implementing condition variables?


Thanks for an interesting piece: I think this could be an interesting
thread ;-)


Dave