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) {
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);
char BANK[5];
......@@ -71,8 +71,9 @@ static void * run(hashpipe_thread_args_t * args) {
char filename[256];
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\n", filename);
sprintf(filename, "/dev/null");
//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);
if (SAVE) {
float * p = (float *)db_in->block[curblock_in].data;
......@@ -36,7 +36,7 @@ static void * run(hashpipe_thread_args_t * args) {
while (run_threads()) {
// 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()) {
hputs(st.buf, status_key, "waiting for free block");
......@@ -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;
char filename[256];
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);
sprintf(filename, "/dev/null");
//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
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