1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-11 00:50:20 +02:00

Improve HRN_FORK*() macros.

Simplify HRN_FORK_CHILD_BEGIN() by adding optional parameters with the common defaults.

Add _FD() to macros that retrieve file descriptors to make their purpose clearer.
This commit is contained in:
David Steele
2021-07-13 14:22:53 -04:00
parent 76cfbf833d
commit 1ace1ac938
26 changed files with 161 additions and 178 deletions

View File

@ -733,10 +733,10 @@ testRun(void)
// Make sure the process times out when it can't get a lock
HRN_FORK_BEGIN()
{
HRN_FORK_CHILD_BEGIN(0, true)
HRN_FORK_CHILD_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE(), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("child read"), HRN_FORK_CHILD_READ_FD(), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("child write"), HRN_FORK_CHILD_WRITE_FD(), 2000);
TEST_RESULT_VOID(
lockAcquire(
@ -755,8 +755,8 @@ testRun(void)
HRN_FORK_PARENT_BEGIN()
{
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_PROCESS(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_PROCESS(0), 2000);
IoRead *read = ioFdReadNewOpen(STRDEF("parent read"), HRN_FORK_PARENT_READ_FD(0), 2000);
IoWrite *write = ioFdWriteNewOpen(STRDEF("parent write"), HRN_FORK_PARENT_WRITE_FD(0), 2000);
// Wait for the child to acquire the lock
ioReadLine(read);