Gamestudio Links
Zorro Links
Newest Posts
Max Number of Strategies in /Strategy folder
by Martin_HH. 06/17/26 07:16
Z9 getting Error 058
by jcl. 06/16/26 09:51
How to select between IB accounts by script?
by AndrewAMD. 06/13/26 15:44
Zorro tutorial ideas?
by AndrewAMD. 06/13/26 15:01
Zorro 3.01 recoded MMI function issue
by 11honza11. 06/13/26 11:40
Stooq now requires an API key
by AndrewAMD. 06/11/26 17:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 3,614 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Student_64151, Koti, curry, DeepxKalsi, Samed
19219 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
Serious User
pegamode  Offline 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:

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] #338888
08/22/10 12:08
08/22/10 12:08
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
If I add a "wait(1);" in my test1-function before calling "test2();" then everything works like expected, but I think that this is just a workaround.

proc_status should be greater than 0 even if the function it checks didn't have called the wait function before.

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 Offline
Expert
EvilSOB  Offline
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: EvilSOB] #338929
08/22/10 19:45
08/22/10 19:45
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Ok ... then we have to wait for JCL coming back from his vacation and hope that this "behaviour" can be changed.

Re: possible bug in proc_status / wait_for ??? [Re: pegamode] #340463
09/04/10 15:15
09/04/10 15:15
Joined: Aug 2000
Posts: 1,141
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,141
Baunatal, Germany
AFAIK proc_status is for checking if a function is running, its not for checking which function called the current function. Only functions containing wait can run at the same time.

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 Offline OP
Serious User
pegamode  Offline 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:

Code:
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:

Code:
void test() {
   wait(1);
   if (proc_status(test) > 0) beep();
   while(1) {
     wait(1);
   }
}



Re: possible bug in proc_status / wait_for ??? [Re: pegamode] #340627
09/06/10 09:06
09/06/10 09:06
Joined: Jul 2000
Posts: 28,108
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,108
Frankfurt
When you follow the program flow, you see that the message you get are perfectly correct. As your functions do not run in parallel, your wait_for does not wait for anything. proc_status counts function instances, but does not count its own function.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1