1
1

Close a minor memory leak - we can reuse timer events

This commit was SVN r19251.
Этот коммит содержится в:
Ralph Castain 2008-08-12 12:53:30 +00:00
родитель 3559ecbadc
Коммит f017c55bfa

Просмотреть файл

@ -36,10 +36,14 @@
#include "orte/mca/plm/base/plm_private.h" #include "orte/mca/plm/base/plm_private.h"
void orte_plm_base_heartbeat(int fd, short event, void *data) #define HEARTBEAT_CK 2
void orte_plm_base_heartbeat(int fd, short event, void *arg)
{ {
opal_buffer_t buf; opal_buffer_t buf;
orte_plm_cmd_flag_t command = ORTE_PLM_HEARTBEAT_CMD; orte_plm_cmd_flag_t command = ORTE_PLM_HEARTBEAT_CMD;
opal_event_t *tmp = (opal_event_t*)arg;
struct timeval now;
int rc; int rc;
/* setup the buffer */ /* setup the buffer */
@ -58,14 +62,14 @@ void orte_plm_base_heartbeat(int fd, short event, void *data)
} }
/* reset the timer */ /* reset the timer */
ORTE_TIMER_EVENT(orte_heartbeat_rate, orte_plm_base_heartbeat); now.tv_sec = orte_heartbeat_rate;
now.tv_usec = 0;
opal_evtimer_add(tmp, &now);
CLEANUP: CLEANUP:
OBJ_DESTRUCT(&buf); OBJ_DESTRUCT(&buf);
} }
#define HEARTBEAT_CK 2
/* this function automatically gets periodically called /* this function automatically gets periodically called
* by the event library so we can check on the state * by the event library so we can check on the state
* of the various orteds * of the various orteds
@ -77,6 +81,8 @@ static void check_heartbeat(int fd, short dummy, void *arg)
orte_job_t *daemons; orte_job_t *daemons;
struct timeval timeout; struct timeval timeout;
bool died = false; bool died = false;
opal_event_t *tmp = (opal_event_t*)arg;
struct timeval now;
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output, OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
"%s plm:base:check_heartbeat", "%s plm:base:check_heartbeat",
@ -122,7 +128,9 @@ static void check_heartbeat(int fd, short dummy, void *arg)
} }
/* reset the timer */ /* reset the timer */
ORTE_TIMER_EVENT(HEARTBEAT_CK*orte_heartbeat_rate, check_heartbeat); now.tv_sec = HEARTBEAT_CK*orte_heartbeat_rate;
now.tv_usec = 0;
opal_evtimer_add(tmp, &now);
} }
void orte_plm_base_start_heart(void) void orte_plm_base_start_heart(void)