Use nanosleep() to implement pg_usleep().
Thomas Munro <tmunro@postgresql.org>
Use nanosleep() to implement pg_usleep(). The previous coding based on select() had commentary about historical portability concerns. Use POSIX nanosleep() instead. This has independently been suggested a couple of times before, but never managed to stick. Since recent and proposed work removes other uses of select(), and associated code and comments relating to its non-portable interaction with signals, it seems like a good time to tidy up this case, too. Also modernize the explanation of why WaitLatch() is a better way to wait. Reviewed-by: Nathan Bossart <nathandbossart@gmail.com> Suggested-by: Paul Guo <paulguo@gmail.com> Suggested-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAAKRu_b-q0hXCBUCAATh0Z4Zi6UkiC0k2DFgoD3nC-r3SkR3tg%40mail.gmail.com Discussion: https://postgr.es/m/CABQrizfxpBLZT5mZeE0js5oCh1tqEWvcGF3vMRCv5P-RwUY5dQ@mail.gmail.com Discussion: https://postgr.es/m/4902.1552349020@sss.pgh.pa.us
Files
| Path | Change | +/− |
|---|---|---|
| src/port/pgsleep.c | modified | +10 −15 |
Discussion
- Use nanosleep() for pg_usleep() on Unix/Linux? 2 messages · 2016-09-11
- Use nanosleep(2) in pg_usleep, if available? 7 messages · 2019-03-12 → 2019-03-13
- Sub-millisecond [autovacuum_]vacuum_cost_delay broken 26 messages · 2023-03-09 → 2023-03-15