Commit 6c06b879 authored by Mitch Burnett's avatar Mitch Burnett
Browse files

Prevent corsave from hanging on quit

Also added checking for run_threads() in the wait free loop in corsave thread.
This lets the thread detect if a signal was received and can exit. Might be a
better way to do this but works for now.

Decreasse indent and clean up code in correlator thread for readability
parent 14552914
...@@ -61,7 +61,7 @@ static void * run(hashpipe_thread_args_t * args) { ...@@ -61,7 +61,7 @@ static void * run(hashpipe_thread_args_t * args) {
break; break;
} }
} }
uint64_t start_mcnt = db_in->block[curblock_in].header.mcnt; //uint64_t start_mcnt = db_in->block[curblock_in].header.mcnt;
int good_data = (int)(db_in->block[curblock_in].header.good_data); int good_data = (int)(db_in->block[curblock_in].header.good_data);
char BANK[5]; char BANK[5];
...@@ -71,8 +71,9 @@ static void * run(hashpipe_thread_args_t * args) { ...@@ -71,8 +71,9 @@ static void * run(hashpipe_thread_args_t * args) {
hashpipe_status_unlock_safe(&st); hashpipe_status_unlock_safe(&st);
char filename[256]; char filename[256];
sprintf(filename, "%s/TGBT16A_508_01/TMP/BF/beamformer_%s_mcnt_%lld.out", data_dir, BANK, (long long)start_mcnt); sprintf(filename, "/dev/null");
fprintf(stderr, "Saving to %s\n", filename); //sprintf(filename, "%s/TGBT16A_508_01/TMP/BF/beamformer_%s_mcnt_%lld.out", data_dir, BANK, (long long)start_mcnt);
//fprintf(stderr, "Saving to %s mcnt: %lld\n", filename, (long long)start_mcnt);
//printf("RTBF: mcnt: %lld\n", (long long)start_mcnt); //printf("RTBF: mcnt: %lld\n", (long long)start_mcnt);
if (SAVE) { if (SAVE) {
float * p = (float *)db_in->block[curblock_in].data; float * p = (float *)db_in->block[curblock_in].data;
......
...@@ -36,7 +36,7 @@ static void * run(hashpipe_thread_args_t * args) { ...@@ -36,7 +36,7 @@ static void * run(hashpipe_thread_args_t * args) {
while (run_threads()) { while (run_threads()) {
// Wait for input buffer block to be filled // Wait for input buffer block to be filled
while ((rv=flag_gpu_correlator_output_databuf_wait_filled(db_in, curblock_in)) != HASHPIPE_OK) { while ((rv=flag_gpu_correlator_output_databuf_wait_filled(db_in, curblock_in)) != HASHPIPE_OK && run_threads()) {
if (rv==HASHPIPE_TIMEOUT) { if (rv==HASHPIPE_TIMEOUT) {
hashpipe_status_lock_safe(&st); hashpipe_status_lock_safe(&st);
hputs(st.buf, status_key, "waiting for free block"); hputs(st.buf, status_key, "waiting for free block");
...@@ -58,11 +58,12 @@ static void * run(hashpipe_thread_args_t * args) { ...@@ -58,11 +58,12 @@ static void * run(hashpipe_thread_args_t * args) {
uint64_t start_mcnt = db_in->block[curblock_in].header.mcnt; //uint64_t start_mcnt = db_in->block[curblock_in].header.mcnt;
//int64_t good_data = db_in->block[curblock_in].header.good_data; //int64_t good_data = db_in->block[curblock_in].header.good_data;
char filename[256]; char filename[256];
sprintf(filename, "%s/TGBT16A_508_01/TMP/BF/cor_mcnt_%lld_%s.out", directory, (long long)start_mcnt, BANK); sprintf(filename, "/dev/null");
fprintf(stderr, "SAV: Saving to %s\n", filename); //sprintf(filename, "%s/TGBT16A_508_01/TMP/BF/cor_mcnt_%lld_%s.out", directory, (long long)start_mcnt, BANK);
//fprintf(stderr, "SAV: Saving to %s\n", filename);
#if SAVE == 1 #if SAVE == 1
Complex * p = (Complex *)db_in->block[curblock_in].data; Complex * p = (Complex *)db_in->block[curblock_in].data;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment