vhost: fix pthread_create() error handling
pthread_create() returns error codes via its return value, not errno. Change-Id: Iac0f2380dd4daf15dc48829a3b9b0a75aedd87d1 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/392984 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
This commit is contained in:
parent
97f145c8b8
commit
591c31f717
@ -1010,13 +1010,15 @@ spdk_vhost_shutdown_cb(void)
|
|||||||
{
|
{
|
||||||
pthread_t tid;
|
pthread_t tid;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
int rc;
|
||||||
struct spdk_event *vhost_app_stop;
|
struct spdk_event *vhost_app_stop;
|
||||||
|
|
||||||
vhost_app_stop = spdk_event_allocate(spdk_env_get_current_core(), session_app_stop, NULL, NULL);
|
vhost_app_stop = spdk_event_allocate(spdk_env_get_current_core(), session_app_stop, NULL, NULL);
|
||||||
|
|
||||||
if (pthread_create(&tid, NULL, &session_shutdown, vhost_app_stop) < 0) {
|
rc = pthread_create(&tid, NULL, &session_shutdown, vhost_app_stop);
|
||||||
spdk_strerror_r(errno, buf, sizeof(buf));
|
if (rc < 0) {
|
||||||
SPDK_ERRLOG("Failed to start session shutdown thread (%d): %s\n", errno, buf);
|
spdk_strerror_r(rc, buf, sizeof(buf));
|
||||||
|
SPDK_ERRLOG("Failed to start session shutdown thread (%d): %s\n", rc, buf);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
pthread_detach(tid);
|
pthread_detach(tid);
|
||||||
|
Loading…
Reference in New Issue
Block a user