1
0
Fork 0

allow the name of the thread in the thread monitor functions

This commit is contained in:
matlads 2010-11-18 06:51:17 +00:00
parent 7c777cd10f
commit 6a459a63f6
5 changed files with 16 additions and 16 deletions

View File

@ -1026,7 +1026,7 @@ static void dispatch_mm7_recv(List *rl)
MmsBoxHTTPClientInfo *h;
hmon->register_thread();
hmon->register_thread( "dispatch_mm7" );
while ((h = gwlist_consume(rl)) != NULL) {
int ret = -1, has_auth = 0;
MmscGrp *m = h->m;
@ -1060,7 +1060,7 @@ static void dispatch_mm7_recv(List *rl)
h->m->mo_errors++;
free_mmsbox_http_clientInfo(h, 1);
}
hmon->unregister_thread();
hmon->unregister_thread( "dispatch_mm7" );
}
void mmsc_receive_func(MmscGrp *m)
@ -1072,7 +1072,7 @@ void mmsc_receive_func(MmscGrp *m)
gwlist_add_producer(mmsc_incoming_reqs);
hmon->register_thread();
hmon->register_thread( "mmsc_receive" );
for (i = 0; i<maxthreads; i++)
thids[i] = gwthread_create((gwthread_func_t *)dispatch_mm7_recv, mmsc_incoming_reqs);
@ -1126,7 +1126,7 @@ void mmsc_receive_func(MmscGrp *m)
gwlist_destroy(mmsc_incoming_reqs, NULL);
gw_free(thids);
hmon->unregister_thread();
hmon->unregister_thread( "mmsc_receive" );
debug("proxy", 0, "MMSBox: MM7 receiver [mmc=%s] Shutting down complete.", octstr_get_cstr(m->id));
}
@ -1780,10 +1780,10 @@ done2:
void mmsbox_outgoing_queue_runner(volatile sig_atomic_t *rstop)
{
hmon->register_thread();
hmon->register_thread( "outgoing_queue" );
qfs->mms_queue_run(octstr_get_cstr(outgoing_qdir),
sendMsg, queue_interval, maxthreads, rstop);
hmon->unregister_thread();
hmon->unregister_thread( "outgoing_queue" );
}

View File

@ -1414,7 +1414,7 @@ static void dispatch_sendmms_recv(List *rl)
{
MmsBoxHTTPClientInfo *h;
hmon->register_thread();
hmon->register_thread( "sendmms_recv" );
while ((h = gwlist_consume(rl)) != NULL) {
SendMmsUser *u = NULL;
List *hh = http_create_empty_headers();
@ -1639,7 +1639,7 @@ static void dispatch_sendmms_recv(List *rl)
free_mmsbox_http_clientInfo(h, 1);
}
hmon->unregister_thread();
hmon->unregister_thread( "sendmms_recv" );
}
@ -1650,7 +1650,7 @@ static void sendmms_func(void *unused)
List *rl = gwlist_create();
hmon->register_thread();
hmon->register_thread( "sendmms" );
gwlist_add_producer(rl);
for (i = 0; i<maxthreads; i++)
@ -1674,5 +1674,5 @@ static void sendmms_func(void *unused)
gwlist_destroy(rl, NULL);
debug("proxy", 0, "MMSBox: MMS-Send Interface shutdown complete. ");
hmon->unregister_thread();
hmon->unregister_thread( "sendmms" );
}

View File

@ -52,7 +52,7 @@ static void cdr_logger_func(void)
{
MmsBoxCdrStruct *cdr;
hmon->register_thread();
hmon->register_thread("cdr_logger");
while ((cdr = gwlist_consume(req_list)) != NULL) {
char buf[CBUFSIZE];
struct tm tm;
@ -84,7 +84,7 @@ static void cdr_logger_func(void)
gw_free(cdr);
}
hmon->unregister_thread();
hmon->unregister_thread("cdr_logger");
}
static int cdr_module_init(char *settings)

View File

@ -1145,7 +1145,7 @@ static void admin_handler(void *unused)
List *cgivars;
Octstr *pass;
hmon->register_thread();
hmon->register_thread( "admin" );
mms_info(0, "mmsbox", NULL,"Admin Interface -- startup on port %d", (int)admin_port);
while((client = http_accept_request(admin_port,
@ -1265,7 +1265,7 @@ static void admin_handler(void *unused)
http_destroy_cgiargs(cgivars);
http_destroy_headers(headers);
}
hmon->unregister_thread();
hmon->unregister_thread( "admin" );
mms_info(0, "mmsbox", NULL,"Admin Interface -- shuttind down on port %d", (int)admin_port);
}

View File

@ -173,8 +173,8 @@ extern MmsBoxCdrFuncStruct *cdrfs;
extern struct MmsBoxHealthMonitors {
void (*register_thread)(void); /* Called by each thread to register itself with the health monitor */
void (*unregister_thread)(void); /* Called by each thread to unregister itself with the health monitor */
void (*register_thread)( char *name); /* Called by each thread to register itself with the health monitor */
void (*unregister_thread)(char *name); /* Called by each thread to unregister itself with the health monitor */
void (*register_port)(short port); /* Called to register each port on which we listen */
void (*unregister_port)(short port); /* Called to unregister each port on which we listen */
} *hmon; /* This should be set if you want to do any thread and port monitoring */