dnxTimer.c File Reference

Implements the DNX Timer thread. More...

#include "dnxTimer.h"
#include "dnxNebMain.h"
#include "dnxError.h"
#include "dnxDebug.h"
#include "dnxSrvProt.h"
#include "dnxJobList.h"
#include "dnxLogging.h"
#include "dnxSleep.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  iDnxTimer_
 DNX job expiration timer implementation structure. More...

Defines

#define DNX_DEF_TIMER_SLEEP   5000
#define MAX_EXPIRED   10

Typedefs

typedef struct iDnxTimer_ iDnxTimer
 DNX job expiration timer implementation structure.

Functions

static void dnxTimerCleanup (void *data)
 Timer thread clean-up routine.
static void * dnxTimer (void *data)
 The main timer thread procedure entry point.
int dnxTimerCreate (DnxJobList *joblist, int sleeptime, DnxTimer **ptimer)
 Create a new job list expiration timer object.
void dnxTimerDestroy (DnxTimer *timer)
 Destroy an existing job list expiration timer object.


Detailed Description

Implements the DNX Timer thread.

The purpose of this thread is to monitor the age of service requests which are being actively executed by the worker nodes.

This requires access to the global Pending queue (which is also manipulated by the Dispatcher and Collector threads.)

Author:
Robert W. Ingraham (dnx-devel@lists.sourceforge.net)
Attention:
Please submit patches to http://dnx.sourceforge.net

Definition in file dnxTimer.c.


Define Documentation

#define DNX_DEF_TIMER_SLEEP   5000

Default timer sleep interval.

Definition at line 54 of file dnxTimer.c.

#define MAX_EXPIRED   10

Maximum expired jobs during interval.

Definition at line 55 of file dnxTimer.c.


Typedef Documentation

typedef struct iDnxTimer_ iDnxTimer

DNX job expiration timer implementation structure.


Function Documentation

static void* dnxTimer ( void *  data  )  [static]

The main timer thread procedure entry point.

Parameters:
[in] data - an opaque pointer to thread data for the timer thread. This is actually the dnx server global data object.
Returns:
Always returns 0.

Definition at line 92 of file dnxTimer.c.

References DnxNodeRequest::address, DnxNewJob::cmd, DNX_MAX_ADDRSTR, DNX_OK, dnxAuditJob(), dnxCancelableSleep(), dnxDebug(), dnxErrorString(), dnxJobCleanup(), dnxJobListExpire(), dnxLog(), dnxNtop(), dnxPostResult(), dnxTimerCleanup(), iDnxTimer_::joblist, MAX_EXPIRED, DnxXID::objSerial, DnxXID::objSlot, DnxNewJob::payload, DnxNewJob::pNode, iDnxTimer_::sleepms, DnxNewJob::start_time, and DnxNewJob::xid.

static void dnxTimerCleanup ( void *  data  )  [static]

Timer thread clean-up routine.

Parameters:
[in] data - an opaque pointer to thread data for the dying thread.
Note:
Currently, this cleanup routine does nothing. It's here just in case the timer code is modified to call cancelable kernel or pthread library routines in the future.

Definition at line 77 of file dnxTimer.c.

int dnxTimerCreate ( DnxJobList joblist,
int  sleeptime,
DnxTimer **  ptimer 
)

Create a new job list expiration timer object.

Parameters:
[in] joblist - the job list that should be expired by the timer.
[in] sleeptime - time between expiration checks, in milliseconds.
[out] ptimer - the address of storage for returning the new object reference.
Returns:
Zero on success, or a non-zero error value.

Definition at line 169 of file dnxTimer.c.

References DNX_DEF_TIMER_SLEEP, DNX_ERR_MEMORY, DNX_ERR_THREAD, DNX_OK, dnxErrorString(), dnxLog(), dnxTimer(), iDnxTimer_::joblist, iDnxTimer_::sleepms, iDnxTimer_::tid, xfree, and xmalloc.

void dnxTimerDestroy ( DnxTimer timer  ) 

Destroy an existing job list expiration timer object.

Parameters:
[in] timer - the timer object to be destroyed.

Definition at line 203 of file dnxTimer.c.

References iDnxTimer_::tid, and xfree.


Generated on Tue Apr 13 15:48:08 2010 for DNX by  doxygen 1.5.6