gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] Re: A problem of using select in gmp_check.


From: bump
Subject: [gnugo-devel] Re: A problem of using select in gmp_check.
Date: Tue, 30 Mar 2004 08:16:03 -0800

> I'm address@hidden
> 
> Hello Dan. I have been reading GNU Go programs a little by little.
> In interface/gmp.c gmp_check(), I feel a question following lines ?

It's best to send this to address@hidden so that
everyone that works on GNU Go can see it. I'm taking the
liberty of forwarding this message to the list.

Note that we didn't write the file gmp.c -- Bill Shubert
did. (But he non longer maintains it.) We are trying to
get the computer world to use the Go Text Protocol instead
of the GMP but we are also interested in having the gmp
work correctly. We haven't had too many reports of
problems with it and it works for tournament play.

Dan

----------------------------

I'm address@hidden

Hello Dan. I have been reading GNU Go programs a little by little.
In interface/gmp.c gmp_check(), I feel a question following lines ?

>    select(ge->inFile + 1, &readReady, NULL, NULL, &noTime);
>    if (!gsleep && !FD_ISSET(ge->inFile, &readReady))
>      return(gmp_nothing);
>    result = getPacket(ge, out1, out2, error);

If timer is setting and event is not happened, select returns in 1 sec.
Program calls getPacket. At the first, getPacket reads data (2 88 87 ff)
or (1 87 87 ff), then returns gmp_nothing.

But the second, getPacket waits until read() returns. 
So heartbeat calls only one time.
    
This is not right way of using select, it seems to me.
If you wanted to call heartbeat many times, look the following for example.

>  GmpResult result = gmp_nothing;
>  int rc;      
>
>    rc = select(ge->inFile + 1, &readReady, NULL, NULL, &noTime);
>    if(rc<0)
>      return (gmp_nothing);
>
>    if(FD_ISSET(ge->inFile, &readReady))
>       result = getPacket(ge, out1, out2, error);
    
But above is not good enough I know, because I feel select should wait long 
time for the first, short time for the next if time cames up.

Anyway if you use select, program should wait in select.
If not, select loses its meaning.


Kunihiro Kusano <address@hidden>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]