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

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "Rady, Doug" <radydoug(at)amazon(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: pgbench - option to build using ppoll() for larger connection counts
Date: 2017-11-29 13:10:58
Message-ID: alpine.DEB.2.20.1711291400390.14718@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2017-11-29 14:05:35 Re: [HACKERS] GUC for cleanup indexes threshold.
Previous Message Robert Haas 2017-11-29 12:58:55 Re: PATCH: pgbench - option to build using ppoll() for larger connection counts