简体   繁体   中英

Simultaneous Object Calls

If I have shared an object between 2 threads (by passing in a void pointer to the object) what happens if they both try to call (different) methods at the same time? I'm not worried about the member variables themselves, there's a mutex in place for other reasons that luckily covers that already. The main function are calling disjoint methods so there's no possibility of overlap that way, but I wasn't sure what the behavior would be if main calls thing.a() while thread calls thing.b() at the same time (or even if they just overlap for that matter).

没什么特别的事情,每个线程都有自己的堆栈,并且每个调用(即使是对同一个函数的调用)也将具有自己的调用框架以及自己的参数和局部变量集。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM