Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Objects and member Functions

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
It is said that all the objects of a class share the same copy of member functions. That means, in a multithreaded environment, same fucntion of a class can not be accessed by two separate threads.

Is it correct?
Or where I am wrong?
 
I actually believe that you are incorrect.
I have done it with out a problem
 
I think that in a multithreaded env. you will have 2 copys of that function. I think this because of a question I asked on the linux forum,about threads. There I was told,that when I use a fork(), (that is the command to dubble the current program,so then you have the program and the same program running in another thread) all data is just copied to another memory segment.

so I'd say,all the objects use the same method,but in the same thread. Once you create onother thread ,it will have its own version off that function (and all objects in that thread will use the same function).

Am I correct?
Greetz,

The Muppeteer.

themuppeteer@hotmail.com

Don't eat yellow snow...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top