开发者

Static method being called in a concurrent environment

I was wondering what would be the outcome (in terms of failure or success) what would happen in this scenario:

I have a class StrHelper with static method +(NSString*) getFirstHalfOf:(NSString*)word and 2 or more methods happen to simultaneously (due to being on different thre开发者_如何学运维ads) call the static method.

Does anyone have an idea of the outcome?


The exact outcome depend on what the method exactly does, but actually there should not be any problems since every thread has his own local variables, and this does not interfere with other threads' local variables.


If there are only local variables, and no modification of global variables (as seems from the method name), there should be no problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜