Critical section in singleton


hello,

i have simple singleton class contains function in an asp.net web site

public membershipuser getmovieowner(guid movieid)

    {

         using (moviesdatacontext mdb = new moviesdatacontext())

        {    

                    guid userid = mdb.moviedatas.where(movie=>movie.movieid == movieid)

                                  .select(movie=>movie.userid)

                                  .single();           

                     return membership.getuser(userid);

        }

    }

my question :

is code should in critical section ?

if user1 call function , , user2 call function ,

 isn't possible user2 change movie id parameter of first user ?
or 2 instances of function create in heap ?

two threads can call method without problem. each thread have own movieid parameter in own stack. don't need lock anything.


Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'