Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 6 months ago.
Is it good to use global variables in running threads ?
Is it good to use global variables in running threads ?
1 Answer
11 years, 6 months ago.
Yes because it is a good way to communicate with other threads. Note however that the globals are shared among the threads and hence need synchronisation. A variable which is not used for communication should be local unless it is very large and consumes the entire stack of the thread.