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

Commitf27a469

Browse files
committed
Remove now unnecessary loop around CallNamedPipe().
Radu Ilie
1 parent04a4413 commitf27a469

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

‎src/port/kill.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*signals that the backend can recognize.
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/port/kill.c,v 1.13 2010/01/02 16:58:13 momjian Exp $
12+
* $PostgreSQL: pgsql/src/port/kill.c,v 1.14 2010/01/31 17:18:28 mha Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -25,7 +25,6 @@ pgkill(int pid, int sig)
2525
BYTEsigData=sig;
2626
BYTEsigRet=0;
2727
DWORDbytes;
28-
intpipe_tries;
2928

3029
/* we allow signal 0 here, but it will be ignored in pg_queue_signal */
3130
if (sig >=PG_SIGNAL_COUNT||sig<0)
@@ -41,23 +40,14 @@ pgkill(int pid, int sig)
4140
}
4241
snprintf(pipename,sizeof(pipename),"\\\\.\\pipe\\pgsignal_%u",pid);
4342

44-
/*
45-
* Writing data to the named pipe can fail for transient reasons.
46-
* Therefore, it is useful to retry if it fails. The maximum number of
47-
* calls to make was empirically determined from a 90-hour notification
48-
* stress test.
49-
*/
50-
for (pipe_tries=0;pipe_tries<3;pipe_tries++)
43+
if (CallNamedPipe(pipename,&sigData,1,&sigRet,1,&bytes,1000))
5144
{
52-
if (CallNamedPipe(pipename,&sigData,1,&sigRet,1,&bytes,1000))
45+
if (bytes!=1||sigRet!=sig)
5346
{
54-
if (bytes!=1||sigRet!=sig)
55-
{
56-
errno=ESRCH;
57-
return-1;
58-
}
59-
return0;
47+
errno=ESRCH;
48+
return-1;
6049
}
50+
return0;
6151
}
6252

6353
if (GetLastError()==ERROR_FILE_NOT_FOUND)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp