Skip to content

Commit

Permalink
gpu_service: didn't set worker thread PTHREAD_CREATE_DETACHED attribute
Browse files Browse the repository at this point in the history
issue at #817
  • Loading branch information
kaigai committed Jul 25, 2024
1 parent ee77f34 commit 02daba4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gpu_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -3168,6 +3168,7 @@ gpuservMonitorClient(void *__priv)
static void
gpuservAcceptClient(gpuContext *gcontext)
{
pthread_attr_t th_attr;
gpuClient *gclient;
pgsocket sockfd;
int errcode;
Expand All @@ -3194,7 +3195,14 @@ gpuservAcceptClient(gpuContext *gcontext)
pthreadMutexInit(&gclient->mutex);
gclient->sockfd = sockfd;

if ((errcode = pthread_create(&gclient->worker, NULL,
/* launch workers */
if (pthread_attr_init(&th_attr) != 0)
__FATAL("failed on pthread_attr_init");
if (pthread_attr_setdetachstate(&th_attr, PTHREAD_CREATE_DETACHED) != 0)
__FATAL("failed on pthread_attr_setdetachstate");

if ((errcode = pthread_create(&gclient->worker,
&th_attr,
gpuservMonitorClient,
gclient)) != 0)
{
Expand Down

0 comments on commit 02daba4

Please sign in to comment.