Code: Select all
bool start = false;
// thread 1
static THD_WORKING_AREA(waThread1, 128);
static THD_FUNCTION(Thread1, arg) {
while(true) {
uprintf(": %u\n", start);
}
}
// main thread
void somefunc() {
start = true;
}
How to share variables between threads? I use the code above but the value of "start" is changed not as expected. When I change the start to true, the print is like:
Code: Select all
:1
:1
:1
:1
:0
:0
:0
:0
...
Why and how to do that correct?