mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-10 21:22:30 +00:00
Modify thread naming to make them easier to identify
This commit is contained in:
parent
301daae6f4
commit
faf63ec036
2
api.c
2
api.c
@ -3636,7 +3636,7 @@ static void *mcast_thread(void *userdata)
|
|||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||||
|
|
||||||
RenameThread("api_mcast");
|
RenameThread("APIMcast");
|
||||||
|
|
||||||
mcast();
|
mcast();
|
||||||
|
|
||||||
|
20
sgminer.c
20
sgminer.c
@ -3266,7 +3266,7 @@ static void *submit_work_thread(void *userdata)
|
|||||||
|
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
|
|
||||||
RenameThread("submit_work");
|
RenameThread("SubmitWork");
|
||||||
|
|
||||||
applog(LOG_DEBUG, "Creating extra submit work thread");
|
applog(LOG_DEBUG, "Creating extra submit work thread");
|
||||||
|
|
||||||
@ -4831,7 +4831,7 @@ static void *input_thread(void __maybe_unused *userdata)
|
|||||||
{
|
{
|
||||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||||
|
|
||||||
RenameThread("input");
|
RenameThread("Input");
|
||||||
|
|
||||||
if (!curses_active)
|
if (!curses_active)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -4868,7 +4868,7 @@ static void *api_thread(void *userdata)
|
|||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||||
|
|
||||||
RenameThread("api");
|
RenameThread("API");
|
||||||
|
|
||||||
set_lowprio();
|
set_lowprio();
|
||||||
api(api_thr_id);
|
api(api_thr_id);
|
||||||
@ -5244,7 +5244,7 @@ static void *stratum_rthread(void *userdata)
|
|||||||
|
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
|
|
||||||
snprintf(threadname, 16, "StratumR/%d", pool->pool_no);
|
snprintf(threadname, sizeof(threadname), "%d/RStratum", pool->pool_no);
|
||||||
RenameThread(threadname);
|
RenameThread(threadname);
|
||||||
|
|
||||||
while (42) {
|
while (42) {
|
||||||
@ -5354,7 +5354,7 @@ static void *stratum_sthread(void *userdata)
|
|||||||
|
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
|
|
||||||
snprintf(threadname, 16, "StratumS/%d", pool->pool_no);
|
snprintf(threadname, sizeof(threadname), "%d/SStratum", pool->pool_no);
|
||||||
RenameThread(threadname);
|
RenameThread(threadname);
|
||||||
|
|
||||||
pool->stratum_q = tq_new();
|
pool->stratum_q = tq_new();
|
||||||
@ -6545,9 +6545,9 @@ void *miner_thread(void *userdata)
|
|||||||
const int thr_id = mythr->id;
|
const int thr_id = mythr->id;
|
||||||
struct cgpu_info *cgpu = mythr->cgpu;
|
struct cgpu_info *cgpu = mythr->cgpu;
|
||||||
struct device_drv *drv = cgpu->drv;
|
struct device_drv *drv = cgpu->drv;
|
||||||
char threadname[24];
|
char threadname[16];
|
||||||
|
|
||||||
snprintf(threadname, 24, "miner/%d", thr_id);
|
snprintf(threadname, sizeof(threadname), "%d/Miner", thr_id);
|
||||||
RenameThread(threadname);
|
RenameThread(threadname);
|
||||||
|
|
||||||
thread_reportout(mythr);
|
thread_reportout(mythr);
|
||||||
@ -6675,7 +6675,7 @@ static void *longpoll_thread(void *userdata)
|
|||||||
char *lp_url;
|
char *lp_url;
|
||||||
int rolltime;
|
int rolltime;
|
||||||
|
|
||||||
snprintf(threadname, 16, "longpoll/%d", cp->pool_no);
|
snprintf(threadname, sizeof(threadname), "%d/Longpoll", cp->pool_no);
|
||||||
RenameThread(threadname);
|
RenameThread(threadname);
|
||||||
|
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
@ -6836,7 +6836,7 @@ static void *watchpool_thread(void __maybe_unused *userdata)
|
|||||||
|
|
||||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||||
|
|
||||||
RenameThread("watchpool");
|
RenameThread("Watchpool");
|
||||||
|
|
||||||
set_lowprio();
|
set_lowprio();
|
||||||
|
|
||||||
@ -6920,7 +6920,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
|
|||||||
|
|
||||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||||
|
|
||||||
RenameThread("watchdog");
|
RenameThread("Watchdog");
|
||||||
|
|
||||||
set_lowprio();
|
set_lowprio();
|
||||||
memset(&zero_tv, 0, sizeof(struct timeval));
|
memset(&zero_tv, 0, sizeof(struct timeval));
|
||||||
|
13
util.c
13
util.c
@ -2545,16 +2545,19 @@ void *str_text(char *ptr)
|
|||||||
|
|
||||||
void RenameThread(const char* name)
|
void RenameThread(const char* name)
|
||||||
{
|
{
|
||||||
|
char buf[16];
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "cg@%s", name);
|
||||||
#if defined(PR_SET_NAME)
|
#if defined(PR_SET_NAME)
|
||||||
// Only the first 15 characters are used (16 - NUL terminator)
|
// Only the first 15 characters are used (16 - NUL terminator)
|
||||||
prctl(PR_SET_NAME, name, 0, 0, 0);
|
prctl(PR_SET_NAME, buf, 0, 0, 0);
|
||||||
#elif (defined(__FreeBSD__) || defined(__OpenBSD__))
|
#elif (defined(__FreeBSD__) || defined(__OpenBSD__))
|
||||||
pthread_set_name_np(pthread_self(), name);
|
pthread_set_name_np(pthread_self(), buf);
|
||||||
#elif defined(MAC_OSX)
|
#elif defined(MAC_OSX)
|
||||||
pthread_setname_np(name);
|
pthread_setname_np(buf);
|
||||||
#else
|
#else
|
||||||
// Prevent warnings for unused parameters...
|
// Prevent warnings
|
||||||
(void)name;
|
(void)buf;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user