comparison core/WriteFile.cpp @ 175:9bfe04d184fb experimental-fixing-AuxiliaryTask

Demonstrates issue #1374
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 28 Dec 2015 15:00:34 +0100
parents 1e7db6610600
children
comparison
equal deleted inserted replaced
174:1e629f126322 175:9bfe04d184fb
19 return; 19 return;
20 staticConstructed=true; 20 staticConstructed=true;
21 threadIsExiting=false; 21 threadIsExiting=false;
22 threadRunning=false; 22 threadRunning=false;
23 writeAllFilesTask = BeagleRT_createAuxiliaryTask(WriteFile::run, 60, "writeAllFilesTask"); 23 writeAllFilesTask = BeagleRT_createAuxiliaryTask(WriteFile::run, 60, "writeAllFilesTask");
24 printf("After writeAllFilesTask\n");
25 dumpAuxTasks();
24 } 26 }
25 27
26 WriteFile::WriteFile(){ 28 WriteFile::WriteFile(){
27 buffer = NULL; 29 buffer = NULL;
28 format = NULL; 30 format = NULL;
29 header = NULL; 31 header = NULL;
30 footer = NULL; 32 footer = NULL;
31 stringBuffer = NULL; 33 stringBuffer = NULL;
34 staticConstructor(); //TODO: this line should be in the constructor, but cannot be because of a bug in BeagleRT
32 }; 35 };
33 36
34 void WriteFile::init(const char* filename){ //if you do not call this before using the object, results are undefined 37 void WriteFile::init(const char* filename){ //if you do not call this before using the object, results are undefined
35 file = fopen(filename, "w"); 38 file = fopen(filename, "w");
36 variableOpen = false; 39 variableOpen = false;
43 sleepTimeMs = 1; 46 sleepTimeMs = 1;
44 stringBufferLength = 1000; 47 stringBufferLength = 1000;
45 stringBuffer = (char*)malloc(sizeof(char) * (stringBufferLength)); 48 stringBuffer = (char*)malloc(sizeof(char) * (stringBufferLength));
46 setHeader("variable=[\n"); 49 setHeader("variable=[\n");
47 setFooter("];\n"); 50 setFooter("];\n");
48 staticConstructor(); //TODO: this line should be in the constructor, but cannot be because of a bug in BeagleRT
49 objAddrs.push_back(this); 51 objAddrs.push_back(this);
50 echoedLines = 0; 52 echoedLines = 0;
51 echoPeriod = 1; 53 echoPeriod = 1;
52 } 54 }
53 55