methodInfo concurrency kind

  • Thread starter Thread starter Abdessamad Belangour
  • Start date Start date
A

Abdessamad Belangour

Hi,
I would like please to know how to get the concurrency kind of a methodInfo
object.
That is, which method of a methodInfo object tells that a call to a method
is : "sequential",
"guarded" or "concurrent" ? is there's not such method inform me too.
Thanks in advance.
 
Abdessamad,

What do you mean by concurrency kind? Are you talking about thread
safety? If so, then there is little that you can get through reflection.
Sections of code can be locked by using the "lock" keyword, and the use of
that isn't reflected.

However, there is the possbility that the method has the MethodImpl
attribute attached to it with a value of MethodImplOptions.Synchronized. If
it is, then the CLR will make sure that access to the method is
synchronized. This you can find through reflection, buy calling the
GetCustomAttributes method on the MethodInfo.

Hope this helps.
 
Abdessamad Belangour said:
I would like please to know how to get the concurrency kind of a methodInfo
object. That is, which method of a methodInfo object tells that a
call to a method is : "sequential", "guarded" or "concurrent" ? is there's n
ot such method inform me too.

There's no such concept in .NET.
 
Back
Top