changeset 175:9bfe04d184fb experimental-fixing-AuxiliaryTask

Demonstrates issue #1374
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 28 Dec 2015 15:00:34 +0100
parents 1e629f126322
children
files core/RTAudio.cpp core/WriteFile.cpp core/default_main.cpp include/BeagleRT.h
diffstat 4 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/core/RTAudio.cpp	Mon Dec 28 13:53:11 2015 +0100
+++ b/core/RTAudio.cpp	Mon Dec 28 15:00:34 2015 +0100
@@ -60,6 +60,16 @@
 
 vector<InternalAuxiliaryTask*> gAuxTasks;
 
+void dumpAuxTasks(){
+	printf("Aux tasks:\n");
+	printf("size: %d\n", gAuxTasks.size());
+	vector<InternalAuxiliaryTask*>::iterator it;
+	for(it = gAuxTasks.begin(); it != gAuxTasks.end(); it++) {
+		InternalAuxiliaryTask* task = *it;
+		printf("[%d] Name: %s\n", it-gAuxTasks.begin(), task->name);
+	}
+	printf("----------\n\n");
+}
 // Flag which tells the audio task to stop
 bool gShouldStop = false;
 
@@ -89,6 +99,8 @@
 
 int BeagleRT_initAudio(BeagleRTInitSettings *settings, void *userData)
 {
+	printf("initaudio\n");
+	dumpAuxTasks();
 	rt_print_auto_init(1);
 
 	BeagleRT_setVerboseLevel(settings->verbose);
@@ -439,6 +451,7 @@
 		free(taskStruct);
 	}
 	gAuxTasks.clear();
+	printf("CLEARED_-------------------------------------\n");
 
 	// Delete the audio task and its interrupt
 #ifdef BEAGLERT_USE_XENOMAI_INTERRUPTS
--- a/core/WriteFile.cpp	Mon Dec 28 13:53:11 2015 +0100
+++ b/core/WriteFile.cpp	Mon Dec 28 15:00:34 2015 +0100
@@ -21,6 +21,8 @@
 	threadIsExiting=false;
 	threadRunning=false;
 	writeAllFilesTask = BeagleRT_createAuxiliaryTask(WriteFile::run, 60, "writeAllFilesTask");
+	printf("After writeAllFilesTask\n");
+	dumpAuxTasks();
 }
 
 WriteFile::WriteFile(){
@@ -29,6 +31,7 @@
 	header = NULL;
 	footer = NULL;
 	stringBuffer = NULL;
+	staticConstructor(); //TODO: this line should be in the constructor, but cannot be because of a bug in BeagleRT
 };
 
 void WriteFile::init(const char* filename){ //if you do not call this before using the object, results are undefined
@@ -45,7 +48,6 @@
 	stringBuffer = (char*)malloc(sizeof(char) * (stringBufferLength));
 	setHeader("variable=[\n");
 	setFooter("];\n");
-	staticConstructor(); //TODO: this line should be in the constructor, but cannot be because of a bug in BeagleRT
 	objAddrs.push_back(this);
 	echoedLines = 0;
 	echoPeriod = 1;
--- a/core/default_main.cpp	Mon Dec 28 13:53:11 2015 +0100
+++ b/core/default_main.cpp	Mon Dec 28 15:00:34 2015 +0100
@@ -32,6 +32,8 @@
 
 int main(int argc, char *argv[])
 {
+	printf("in main\n");
+	dumpAuxTasks();
 	BeagleRTInitSettings settings;	// Standard audio settings
 
 	struct option customOptions[] =
--- a/include/BeagleRT.h	Mon Dec 28 13:53:11 2015 +0100
+++ b/include/BeagleRT.h	Mon Dec 28 15:00:34 2015 +0100
@@ -23,7 +23,7 @@
  *
  * Further information can be found at http://beaglert.cc
  */
-
+void dumpAuxTasks();
 
 #ifndef BEAGLERT_H_
 #define BEAGLERT_H_