|
0 registered members (),
3,614
guests, and 4
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
possible bug in proc_status / wait_for ???
#338884
08/22/10 11:51
08/22/10 11:51
|
Joined: Feb 2006
Posts: 1,011 Germany
pegamode
OP
Serious User
|
OP
Serious User
Joined: Feb 2006
Posts: 1,011
Germany
|
Could it be that there's a bug in proc_status (A7.85.4)? Look at the following code:
void main();
void test1();
void test2();
void test2() {
diag("\ntest2 start");
wait_for(test1);
diag("\ntest2 do something");
diag("\ntest2 end");
}
void test1() {
diag("\ntest1 start");
test2();
diag("\ntest1 do something");
diag("\ntest1 end");
}
void main() {
diag("\nmain start");
test1();
}
In my acklog.txt I expected the following: test1 start test2 start test1 do something test1 end test2 do something test2 end But I get: test1 start test2 start test2 do something test2 end test1 do something test1 end So "wait_for(test1)" isn't waiting (proc_status(test1) == 0) ... is there something I'm missing or is this a bug? Regards, Pegamode.
|
|
|
Re: possible bug in proc_status / wait_for ???
[Re: pegamode]
#338923
08/22/10 19:08
08/22/10 19:08
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I can almost remember this issue.
I cant remember if it was classified as a bug or not, but from memory (and a test I did a minute ago), it seems that the proc_status 'list' of running functions only recieves a function when that function hits its first 'wait', just as you discovered, pegamode.
But I can almost remember this from ages past. I just cant remember if it is a 'forgotten' bug still awaiting a fix, or if it was something we have to live with...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: possible bug in proc_status / wait_for ???
[Re: Tobias]
#340476
09/04/10 16:22
09/04/10 16:22
|
Joined: Feb 2006
Posts: 1,011 Germany
pegamode
OP
Serious User
|
OP
Serious User
Joined: Feb 2006
Posts: 1,011
Germany
|
Yeah, but currently for proc_status a function isn't running if it hasn't called a wait before. For example:
void test() {
if (proc_status(test) > 0) beep();
while(1) {
wait(1);
}
}
In this case proc_status wouldn't find the currently started thread. You would have to change it like this:
void test() {
wait(1);
if (proc_status(test) > 0) beep();
while(1) {
wait(1);
}
}
|
|
|
|