lib/event: improve portability

In _set_thread_name, use pthread_setname_np as the default for
platforms that are not Linux or FreeBSD; it's the most common
'non-portable' pthread extension used to set the thread name.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Ia841166f0537cd1303eded15bc7ef1a9f03e3b6e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6465
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Nick Connolly 2021-02-18 17:36:52 +00:00 committed by Tomasz Zawadzki
parent 1d8861e58f
commit a14deb22e0

View File

@ -648,7 +648,7 @@ _set_thread_name(const char *thread_name)
#elif defined(__FreeBSD__)
pthread_set_name_np(pthread_self(), thread_name);
#else
#error missing platform support for thread name
pthread_setname_np(pthread_self(), thread_name);
#endif
}