Reputation: 15
I have a application and it is used by multiple users at a same time . i wanted to use a common function say for example number format
public class CustomFormat
{
public static function funt(val:int,prec:int):int
{
// return val with formatting along with prec
}
}
As static
functions are attached to classes not to the instances .
now assume the case when two user's call that CustomFormat.funt(2,2);
& CustomFormat.funt(3,3);
at same time how this will act . i guess there might me issue in result's . to try still i did not implement this , so any suggestion's , if this has issue then i need create an object for each request or anything else i need to do
thanks
Upvotes: 0
Views: 116
Reputation: 2310
You have a misconception of what an swf based application is.
Every user that loads your app will have an unique instance of the app: it is a client app that runs inside your user's browser. It's not possible that several users could be accessing at the same time to your static function because it's not running that way (i.e. inside a server).
And considering that your app is single threaded (you're not using AS3 Workers) each call to the static function will be executed in order.
In other case, you should consider your static function as a shared resource, so you will have to implement concurrent mechanisms in order to assure a correct access of it.
Upvotes: 3