Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e86c61

Browse files
committed
Arrange for on_exit_nicely to be thread-safe.
Extracted from Joachim Wieland's parallel pg_dump patch, with someadditional comments by me.
1 parent38b9693 commit5e86c61

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

‎src/bin/pg_dump/dumputils.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,16 +1319,18 @@ on_exit_nicely(on_exit_nicely_callback function, void *arg)
13191319
on_exit_nicely_index++;
13201320
}
13211321

1322-
/* Run accumulated on_exit_nicely callbacks and then exit quietly. */
1322+
/*
1323+
* Run accumulated on_exit_nicely callbacks in reverse order and then exit
1324+
* quietly. This needs to be thread-safe.
1325+
*/
13231326
void
13241327
exit_nicely(intcode)
13251328
{
1326-
while (--on_exit_nicely_index >=0)
1327-
(*on_exit_nicely_list[on_exit_nicely_index].function)(code,
1328-
on_exit_nicely_list[on_exit_nicely_index].arg);
1329-
#ifdefWIN32
1330-
if (parallel_init_done&&GetCurrentThreadId()!=mainThreadId)
1331-
ExitThread(code);
1332-
#endif
1329+
inti;
1330+
1331+
for (i=on_exit_nicely_index-1;i >=0;i--)
1332+
(*on_exit_nicely_list[i].function)(code,
1333+
on_exit_nicely_list[i].arg);
1334+
13331335
exit(code);
13341336
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp