|
|
@ -2510,11 +2510,11 @@ bool _cg_completion_timeout(void *fn, void *fnarg, int timeout, const char *file |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct cg_completion *cgc; |
|
|
|
struct cg_completion *cgc; |
|
|
|
pthread_t pthread; |
|
|
|
pthread_t pthread; |
|
|
|
bool ret; |
|
|
|
bool ret = false; |
|
|
|
|
|
|
|
|
|
|
|
cgc = malloc(sizeof(struct cg_completion)); |
|
|
|
cgc = malloc(sizeof(struct cg_completion)); |
|
|
|
if (unlikely(!cgc)) |
|
|
|
if (unlikely(!cgc)) |
|
|
|
return false; |
|
|
|
return ret; |
|
|
|
cgsem_init(&cgc->cgsem); |
|
|
|
cgsem_init(&cgc->cgsem); |
|
|
|
cgc->fn = fn; |
|
|
|
cgc->fn = fn; |
|
|
|
cgc->fnarg = fnarg; |
|
|
|
cgc->fnarg = fnarg; |
|
|
@ -2522,7 +2522,7 @@ bool _cg_completion_timeout(void *fn, void *fnarg, int timeout, const char *file |
|
|
|
pthread_create(&pthread, NULL, completion_thread, (void *)cgc); |
|
|
|
pthread_create(&pthread, NULL, completion_thread, (void *)cgc); |
|
|
|
|
|
|
|
|
|
|
|
ret = cgsem_mswait(&cgc->cgsem, timeout); |
|
|
|
ret = cgsem_mswait(&cgc->cgsem, timeout); |
|
|
|
if (ret) |
|
|
|
if (!ret) |
|
|
|
free(cgc); |
|
|
|
free(cgc); |
|
|
|
return ret; |
|
|
|
return !ret; |
|
|
|
} |
|
|
|
} |
|
|
|