This may seem like an obvious-answered question (and likely is), but I just want to be sure. Suppose I have a global method within a module called ‘getSessionStatus’ which checks the session cookie against a dictionary, and returns a boolean on whether the sessionid in that cookie is already registered in the dictionary as active. Now, suppose I just had 12 simultaneous calls to that method from the session class (from different user sessions) within a web project. Am I guaranteed that what is returned for a specific call to that method is actually to the proper session that initiated it? I guess what I’m asking, are calls to methods within a module on their own threaded instance and it’s assumed what instance called the method is the instance the return is passed to?
Not as far as I’m aware, usually when dealing with global functions in a module for an app, they are global throughout the application. Is the dictionary in the module too? If it’s a local dictionary then I can see that that your validation is global.
Yeah, dictionary is also dim’d as a property in the module too, but only accessible and used by methods within the module itself. So, let’s say I have two sessions (labeled sessionA and sessionB) and pass a variable to one of the methods within a module containing ‘A’ (sent from ‘sessionA’) and ‘B’ (sent from ‘sessionB’). If the method within the module contained:
[code]function test(inputCharacter as string) as boolen
if inputCharacter = “A” then
You mean that it’s possible (assuming timing is just right, etc.) that this method would return TRUE for ‘sessionB’ and/or FALSE for ‘sessionA’?
^well, it won’t let me edit… but assuming also I spelled ‘boolean’ correctly.
No, that wouldn’t be possible. Parameters are local variables and are therefore unique to the thread that called them. Global variables are where you run into problems.