mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-04-18 21:44:02 +03:00
MCOL-5881 set/getThreadName use FreeBSD API (#3383)
Taken from FreeBSD ports, this uses the FreeBSD APIs rather than the Linux specific prctl to change and retreive the thread names. Co-authored-by: Bernard Spil <brnrd@FreeBSD.org>
This commit is contained in:
parent
f99c24b47d
commit
7dcc6a251a
@ -22,13 +22,21 @@ namespace utils
|
||||
{
|
||||
void setThreadName(const char* threadName)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
pthread_set_name_np(pthread_self(), threadName);
|
||||
#else
|
||||
prctl(PR_SET_NAME, threadName, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string getThreadName()
|
||||
{
|
||||
char buf[32];
|
||||
#ifdef __FreeBSD__
|
||||
pthread_get_name_np(pthread_self(), buf, sizeof(buf));
|
||||
#else
|
||||
prctl(PR_GET_NAME, buf, 0, 0, 0);
|
||||
#endif
|
||||
return std::string(buf);
|
||||
}
|
||||
} // namespace utils
|
||||
|
Loading…
x
Reference in New Issue
Block a user