Pause can have a timeout value on it, so if for example the maximum time you 
want to wait is 10 seconds, PAUSE can automatically resume then, at which point 
you can check if the phantom is still running or a flag doesn't exist.

Still doesn't solve your UniData only problem though.

Regards,
Dan


-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Doug Farmer
Sent: Friday, December 28, 2012 8:22 AM
To: 'U2 Users List'
Subject: Re: [U2] Sleeping in Basic

Wow, thanks of all of the responses. Unfortunately, none of them will seem to 
work on UniData. I will be using NAP on UniVerse.

PAUSE and WAKE, I had not heard of. This is only on UniData so not a UniVerse 
option. It would seem to be a good way to go, except for if the phantom process 
aborts, the WAKE is never executed and the invoking process (UniObjects 
subroutine) hangs forever.

David's openSocket suggestion does not wait at all if the socket can be opened. 
If it cannot (for example host name is bad), the timeout is sometimes much 
longer, probably due to DNS lookup of the bad host name.

I tried these examples in the code below. The results are show below the code.


When I run this, using NAP 250, I get 4 times the same, then another 4 times 
the same etc. This seems to show NAP 250 does sleep for a quarter of a second. 

Doing NAP 1 for 2000 iterations took 31 seconds. Probably due to overhead of 
setting up NAP 2000 times.

The openSocket came right back all the time.

Any other ideas, I am open to testing.

Again, thanks for all of the responses!


Doug Farmer
952-417-5225
Program Listing

0001       PRINT 'Nap 250'
0002       FOR IDX = 1 TO 20
0003          PRINT IDX "R#2":' ':OCONV(TIME(),'MTS')
0004          NAP 250
0005       NEXT IDX
0006       PRINT 'Start of 2000'
0007       PRINT OCONV(TIME(),'MTS')
0008       FOR IDX = 1 TO 2000
0009          NAP 1
0010       NEXT IDX
0011       PRINT OCONV(TIME(),'MTS')
0012       PRINT 'DONE WITH 2000'
0013       PRINT 'Open Socket'
0014       FOR IDX = 1 TO 20
0015          SleepTime = 250
0016          ERR = openSocket('loopback',25,1,SleepTime,HBUFF)
0017          PRINT IDX "R#2":' ':OCONV(TIME(),'MTS')
0018       NEXT IDX

Output from Program
Nap 250
 1 09:11:29
 2 09:11:29
 3 09:11:29
 4 09:11:30
 5 09:11:30
 6 09:11:30
 7 09:11:30
 8 09:11:31
 9 09:11:31
10 09:11:31
11 09:11:31
12 09:11:32
13 09:11:32
14 09:11:32
15 09:11:32
16 09:11:33
17 09:11:33
18 09:11:33
19 09:11:33
20 09:11:34
Start of 2000
09:11:34
09:12:05
DONE WITH 2000
Open Socket
 1 09:12:05
 2 09:12:05
 3 09:12:05
 4 09:12:05
 5 09:12:05
 6 09:12:05
 7 09:12:05
 8 09:12:05
 9 09:12:05
10 09:12:05
11 09:12:05
12 09:12:05
13 09:12:05
14 09:12:05
15 09:12:05
16 09:12:05
17 09:12:05
18 09:12:05
19 09:12:05
20 09:12:05



This message has been scanned for malware by Websense. www.websense.com 
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to