Re: PATCH: pgbench - option to build using ppoll() for largerconnection counts

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: PATCH: pgbench - option to build using ppoll() for largerconnection counts
Дата
Msg-id alpine.DEB.2.20.1711291400390.14718@lancre
обсуждение исходный текст
Ответ на Re: PATCH: pgbench - option to build using ppoll() for largerconnection counts  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: PATCH: pgbench - option to build using ppoll() for largerconnection counts
Список 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 по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: PATCH: pgbench - option to build using ppoll() for largerconnection counts
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: [HACKERS] GUC for cleanup indexes threshold.