are static functions threadsafe?

  • Thread starter Thread starter David
  • Start date Start date
D

David

I have a static method in the dll that looks like this

public static int myStaticFunction(int input){
}

My question is, should I use a mutex inside the function to ensure that the
function is threadsafe? This is used for ASP.NET. I am asking this
question without knowing how IIS works as a multi-threaded application.
Does each websession get a thread? If so, if two users are calling the
static function at the same time, do they
- act as two seperate threads?
- If so, are static functions threadsafe?
 
They are not thread safe, and you need to synchronize them.

There will be a separate thread for each user accessing the web server.
 
Thank you. My friend and I have been debating this. Is there some
documentation you could point me to?
 
Back
Top