diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-08-27 16:47:39 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-08-27 16:47:39 +0000 |
commit | 8c7bfd4bf4ce673d78c085a272ffb3377cfd1899 (patch) | |
tree | 8f4107a7df7393f03175ea64fdfcef693981eebd /src/main/ScheduleInterface.c | |
parent | 45fc194765402d081a44d1fb4776b3c4aa6fa1d2 (diff) |
Check return code of CCTK_CreateTimer().
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2320 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/ScheduleInterface.c')
-rw-r--r-- | src/main/ScheduleInterface.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/main/ScheduleInterface.c b/src/main/ScheduleInterface.c index ca222687..82a72972 100644 --- a/src/main/ScheduleInterface.c +++ b/src/main/ScheduleInterface.c @@ -1192,6 +1192,11 @@ static t_attribute *CreateAttribute(const char *description, timername = (char *) malloc (strlen (thorn) + strlen (description) + 3); sprintf (timername, "%s: %s", thorn, description); this->timer_handle = CCTK_TimerCreate(timername); + if (this->timer_handle < 0) + { + CCTK_VWarn (5, __LINE__, __FILE__, "Cactus", + "Couldn't create timer with name '%s'", timername); + } free (timername); } else @@ -2171,14 +2176,20 @@ static int CCTKi_ScheduleCallFunction(void *function, t_attribute *attribute, t_sched_data *data) { - CCTK_TimerStartI(attribute->timer_handle); + if (attribute->timer_handle >= 0) + { + CCTK_TimerStartI(attribute->timer_handle); + } /* Use whatever has been chosen as the calling function for this * function. */ data->synchronised = data->CallFunction(function, &(attribute->FunctionData), data->GH); - CCTK_TimerStopI(attribute->timer_handle); + if (attribute->timer_handle >= 0) + { + CCTK_TimerStopI(attribute->timer_handle); + } return 1; } @@ -2224,17 +2235,20 @@ static int CCTKi_SchedulePrintTimesFunction(void *function, /* prevent compiler warnings about unused parameters */ function = function; - CCTK_TimerI(attribute->timer_handle, data->info); - - if(data->print_headers) + if (attribute->timer_handle >= 0) { - CCTKi_SchedulePrintTimerHeaders(data->info); + CCTK_TimerI(attribute->timer_handle, data->info); - data->print_headers = 0; - } + if(data->print_headers) + { + CCTKi_SchedulePrintTimerHeaders(data->info); - CCTKi_SchedulePrintTimerInfo(data->info, data->total_time, - attribute->thorn, attribute->description); + data->print_headers = 0; + } + + CCTKi_SchedulePrintTimerInfo(data->info, data->total_time, + attribute->thorn, attribute->description); + } return 1; } |