c++ - the variable with the same name in multi threads environment -
i have class file. created 2 threads , b. in , b, each thread, create auto varible file myfile. , , b operate it. secure? lead inconsistent of data?
from pure memory ressource perspective, depend on scope of file variables :
if local function variables, go. each thread of execution owns own stack, totally separate other threads, create local variables.
if
static, referring same global address.
from file access perspective, depends if same file, , if writing or not.
Comments
Post a Comment