mirror of https://github.com/BOINC/boinc.git
parent
b00d219d2e
commit
b6defb3f8f
|
@ -197,8 +197,9 @@ void boinc_catch_signal(int signal) {
|
||||||
fprintf( stderr, "unknown signal %d", signal );
|
fprintf( stderr, "unknown signal %d", signal );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
fprintf( stderr, "\nExiting...\n" );
|
||||||
#endif
|
#endif
|
||||||
exit(signal);
|
exit(ERR_SIGNAL_CATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
int boinc_finish(int status) {
|
int boinc_finish(int status) {
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "filesys.h"
|
#include "filesys.h"
|
||||||
#include "boinc_api.h"
|
#include "boinc_api.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
int run_slow = 0;
|
int run_slow = 0;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
// debugging
|
// debugging
|
||||||
// -cpu_time: app will chew up some CPU cycles after each character,
|
// -cpu_time: app will chew up some CPU cycles after each character,
|
||||||
// used for testing CPU time reporting
|
// used for testing CPU time reporting
|
||||||
|
// -signal: app will raise SIGHUP signal (for testing signal handler)
|
||||||
//
|
//
|
||||||
// This version does one char/second,
|
// This version does one char/second,
|
||||||
// and writes its state to disk every so often
|
// and writes its state to disk every so often
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <signal.h>
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -71,7 +73,7 @@ char the_char[10];
|
||||||
double xPos=0, yPos=0;
|
double xPos=0, yPos=0;
|
||||||
double xDelta=0.03, yDelta=0.07;
|
double xDelta=0.03, yDelta=0.07;
|
||||||
|
|
||||||
int run_slow=1,cpu_time=0;
|
int run_slow=0,cpu_time=0,raise_signal=0;
|
||||||
time_t my_start_time;
|
time_t my_start_time;
|
||||||
APP_INIT_DATA uc_aid;
|
APP_INIT_DATA uc_aid;
|
||||||
|
|
||||||
|
@ -155,6 +157,7 @@ int main(int argc, char **argv) {
|
||||||
fprintf(stderr, "APP: upper_case: argv[%d] is %s\n", i, argv[i]);
|
fprintf(stderr, "APP: upper_case: argv[%d] is %s\n", i, argv[i]);
|
||||||
if (!strcmp(argv[i], "-run_slow")) run_slow = 1;
|
if (!strcmp(argv[i], "-run_slow")) run_slow = 1;
|
||||||
if (!strcmp(argv[i], "-cpu_time")) cpu_time = 1;
|
if (!strcmp(argv[i], "-cpu_time")) cpu_time = 1;
|
||||||
|
if (!strcmp(argv[i], "-signal")) raise_signal = 1;
|
||||||
}
|
}
|
||||||
in = fopen(resolved_name, "r");
|
in = fopen(resolved_name, "r");
|
||||||
boinc_resolve_filename(CHECKPOINT_FILE, resolved_name, sizeof(resolved_name));
|
boinc_resolve_filename(CHECKPOINT_FILE, resolved_name, sizeof(resolved_name));
|
||||||
|
@ -202,6 +205,10 @@ int main(int argc, char **argv) {
|
||||||
boinc_sleep(1);
|
boinc_sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (raise_signal) {
|
||||||
|
raise(SIGHUP);
|
||||||
|
}
|
||||||
|
|
||||||
if (boinc_time_to_checkpoint()) {
|
if (boinc_time_to_checkpoint()) {
|
||||||
retval = do_checkpoint(out, nchars);
|
retval = do_checkpoint(out, nchars);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
|
|
|
@ -49,3 +49,5 @@
|
||||||
#define ERR_DUP2 -121
|
#define ERR_DUP2 -121
|
||||||
#define ERR_NO_SIGNATURE -122
|
#define ERR_NO_SIGNATURE -122
|
||||||
#define ERR_THREAD -123
|
#define ERR_THREAD -123
|
||||||
|
#define ERR_SIGNAL_CATCH -124
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue