Skip to content

Commit

Permalink
shutdown moxi on EOL in addition to EOF
Browse files Browse the repository at this point in the history
So that erlang can reliably shutdown moxi.

Change-Id: Ie31b4b577a5454115e251c92392306337e6be988
Reviewed-on: http://review.membase.org/6070
Tested-by: Steve Yen <steve.yen@gmail.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
  • Loading branch information
Aliaksey Kandratsenka authored and steveyen committed May 9, 2011
1 parent d4c8d95 commit 1f5d894
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions stdin_check.c
Expand Up @@ -9,14 +9,16 @@


static void* check_stdin_thread(void* arg) static void* check_stdin_thread(void* arg)
{ {
int ch;

(void)arg; (void)arg;
pthread_detach(pthread_self()); pthread_detach(pthread_self());


while (!feof(stdin)) { do {
getc(stdin); ch = getc(stdin);
} } while (ch != EOF && ch != '\n' && ch != '\r');


moxi_log_write("EOF on stdin. Exiting\n"); fprintf(stderr, "%s on stdin. Exiting\n", (ch == EOF) ? "EOF" : "EOL");
exit(0); exit(0);
/* NOTREACHED */ /* NOTREACHED */
return NULL; return NULL;
Expand Down

0 comments on commit 1f5d894

Please sign in to comment.