Skip to content
Permalink
Browse files

Fix #385 leak of preread thread (keep valgrind silent on exit)

  • Loading branch information
klirichek committed Aug 14, 2018
1 parent c74d0b4 commit 6e5b57e1d3952c9695376728a143bf5434208f53
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/searchd.cpp
g_bLogTty = isatty ( g_iLogFile )!=0;
}

SphThread_t g_thPreread;
void JoinPrereadThread ()
{
sphThreadJoin ( &g_thPreread );
}

int WINAPI ServiceMain ( int argc, char **argv ) REQUIRES (!MainThread)
{
ScopedRole_c thMain (MainThread);
PrereadFunc ( NULL );
} else
{
SphThread_t tTmpPreread;
if ( !sphThreadCreate ( &tTmpPreread, PrereadFunc, 0, true ) )
if ( !sphThreadCreate ( &g_thPreread, PrereadFunc, 0, true ) )
sphWarning ( "failed to create preread thread" );
else
atexit( &JoinPrereadThread );
}

// almost ready, time to start listening

0 comments on commit 6e5b57e

Please sign in to comment.