Change thread name for the main kqueue event loop to "<vmname> mevent" so

it can be easily distinguished from other non-vCPU threads in forthcoming
changes.

Obtained from:	NetApp
This commit is contained in:
grehan 2012-12-20 23:01:53 +00:00
parent bc64633d9d
commit 5bbdfeda58

View File

@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h>
#include <pthread.h>
#include <pthread_np.h>
#include "mevent.h"
@ -55,6 +56,8 @@ __FBSDID("$FreeBSD$");
#define MEV_DISABLE 2
#define MEV_DEL_PENDING 3
extern char *vmname;
static pthread_t mevent_tid;
static int mevent_pipefd[2];
static pthread_mutex_t mevent_lmutex = PTHREAD_MUTEX_INITIALIZER;
@ -356,6 +359,15 @@ mevent_delete_close(struct mevent *evp)
return (mevent_delete_event(evp, 1));
}
static void
mevent_set_name(void)
{
char tname[MAXCOMLEN + 1];
snprintf(tname, sizeof(tname), "%s mevent", vmname);
pthread_set_name_np(mevent_tid, tname);
}
void
mevent_dispatch(void)
{
@ -367,6 +379,7 @@ mevent_dispatch(void)
int ret;
mevent_tid = pthread_self();
mevent_set_name();
mfd = kqueue();
assert(mfd > 0);