Re: PATCH: pgbench - option to build using ppoll() for largerconnection counts - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: PATCH: pgbench - option to build using ppoll() for largerconnection counts
Date
Msg-id alpine.DEB.2.20.1711291400390.14718@lancre
Whole thread Raw
In response to Re: PATCH: pgbench - option to build using ppoll() for largerconnection counts  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: PATCH: pgbench - option to build using ppoll() for largerconnection counts
List pgsql-hackers
Hello Robert,

>> ever is best. Not sure that "pfds" is the right name. If the two variables
>> means the same thing, they should have the same name, although possibly
>> different types.
>
> Although I agree with a good bit of what you say here, I don't agree
> with that.  If the member used by ppoll() (or just poll()) has a
> different name than the one used for select(), it's much easier to,
> say, grep for everyplace where the field you care about is used.  If
> you use the same name for different things, that doesn't work.

I'm not sure it is incompatible.

My point is consistent with my other advice which is to hide the stuff in 
functions with identical (or compatible) signatures, so that the only 
place where it would differ would be in the functions, where greping would 
work.
 #ifdef USE_POLL  // pool specific stuff  #define SOME_TYPE v1_type (or typedef)  void do_stuff(v1_type * stuff) { ...
} ... #else /* default to SELECT */  // select specific stuff  #define SOME_TYPE v2_type (idem)  void do_stuff(v2_type
*stuff) { ... }  ... #endif
 

Then later the code is not specific to poll or select, eg:
 SOME_TYPE mask; do_stuff(mask); do_other_stuff(...); if (is_ready(mask, ...)) { ... }

-- 
Fabien.


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: PATCH: pgbench - option to build using ppoll() for largerconnection counts
Next
From: Simon Riggs
Date:
Subject: Re: [HACKERS] GUC for cleanup indexes threshold.