poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] mi: Make sure fd is non-blocking before select+read.


From: Jose E. Marchesi
Subject: Re: [PATCH] mi: Make sure fd is non-blocking before select+read.
Date: Tue, 12 May 2020 18:39:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)


    >     +
    >        pk_mi_exit_p = 0;
    >     -  while (1)
    >     +
    >     +  while (ret != -1 && ret != -2 && pk_mi_exit_p == 0)
    > 
    > This change in the loop, I don't like.
    > 
    > Before, the logic involving `ret' was only in one place.
    > 
    > With the proposed change the logic is in two places, so if we add a new
    > `ret' value we may have to update _both_ the `while' condition and the
    > if..elseif at the bottom of the function.
    > 
    > Doesn't sound like an improvement to me...
    
    I agree. The other approach would be to call pk_mi_fd_restore_blocking
    before each return. If you like this more, I'll change it.

What about something in the line:

  if (pk_mi_exit_p)
  {
    ret = 1;
    break;
  }
  else if (ret == -1)
  {
    ret = -1;
    break;
  }
  ...
    
    Just want to mention that proper poke error codes, used by all
    functions, would release us from making that suspicious return value
    'translations' in the loop.

Damn right!  Right now each function has its own conventions... it would
be nice to fix that.



reply via email to

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