B
beginwithl
hi
I haven’t yet covered the attributes and object contexts, so I may be
missing something quite obvious …
1) Say we have class A marked with [synchronized] attribute and
instance B of that class.
I assume using synchronized attribute on B in essence produces same/
similar effects as if all methods of B would have lock inside of them
and as if all these locks would use same private object as a token?!
2) In what situations would we choose synchronized attribute over
Monitor.Enter()? One situation I can think of is if we wanted all
instance methods of a class to be synchronized, but there must be
other reasons also?!
thank you
I haven’t yet covered the attributes and object contexts, so I may be
missing something quite obvious …
1) Say we have class A marked with [synchronized] attribute and
instance B of that class.
I assume using synchronized attribute on B in essence produces same/
similar effects as if all methods of B would have lock inside of them
and as if all these locks would use same private object as a token?!
2) In what situations would we choose synchronized attribute over
Monitor.Enter()? One situation I can think of is if we wanted all
instance methods of a class to be synchronized, but there must be
other reasons also?!
thank you