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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top