You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
fix(utils): MCOL-5881 set/getThreadName use FreeBSD API (#3384)
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:
@ -22,13 +22,21 @@ namespace utils
|
|||||||
{
|
{
|
||||||
void setThreadName(const char* threadName)
|
void setThreadName(const char* threadName)
|
||||||
{
|
{
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
pthread_set_name_np(pthread_self(), threadName);
|
||||||
|
#else
|
||||||
prctl(PR_SET_NAME, threadName, 0, 0, 0);
|
prctl(PR_SET_NAME, threadName, 0, 0, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getThreadName()
|
std::string getThreadName()
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
pthread_get_name_np(pthread_self(), buf, sizeof(buf));
|
||||||
|
#else
|
||||||
prctl(PR_GET_NAME, buf, 0, 0, 0);
|
prctl(PR_GET_NAME, buf, 0, 0, 0);
|
||||||
|
#endif
|
||||||
return std::string(buf);
|
return std::string(buf);
|
||||||
}
|
}
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
Reference in New Issue
Block a user