Commit e7b3122e authored by Mikhail Karpenko's avatar Mikhail Karpenko

Update debug macros for streamer and video classes

parent 99103819
...@@ -38,11 +38,17 @@ using namespace std; ...@@ -38,11 +38,17 @@ using namespace std;
* @return None * @return None
*/ */
void clean_up(pthread_t *threads, size_t sz) { void clean_up(pthread_t *threads, size_t sz) {
for (size_t i = 0; i < sz; i++) int ret_val;
pthread_cancel(threads[i]);
for (size_t i = 0; i < sz; i++) {
ret_val = pthread_cancel(threads[i]);
if (!ret_val)
cout << "pthread_cancel returned " << ret_val << ", sensor port " << i << endl;
}
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
int ret_val;
string opt; string opt;
map<string, string> args; map<string, string> args;
pthread_t threads[SENSOR_PORTS]; pthread_t threads[SENSOR_PORTS];
...@@ -72,8 +78,10 @@ int main(int argc, char *argv[]) { ...@@ -72,8 +78,10 @@ int main(int argc, char *argv[]) {
streamers[i] = new Streamer(args, i); streamers[i] = new Streamer(args, i);
pthread_attr_init(&attr); pthread_attr_init(&attr);
if (!pthread_create(&threads[i], &attr, Streamer::pthread_f, (void *) streamers[i])) { ret_val = pthread_create(&threads[i], &attr, Streamer::pthread_f, (void *) streamers[i]);
cerr << "Can not spawn streamer thread for port " << i << endl; if (ret_val != 0) {
cerr << "Can not spawn streamer thread for port " << i;
cerr << ", pthread_create returned " << ret_val << endl;
clean_up(threads, SENSOR_PORTS); clean_up(threads, SENSOR_PORTS);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
......
...@@ -47,6 +47,7 @@ public: ...@@ -47,6 +47,7 @@ public:
off_t lseek(off_t offset, int whence) { return ::lseek(fd_fparmsall, offset, whence); } off_t lseek(off_t offset, int whence) { return ::lseek(fd_fparmsall, offset, whence); }
bool daemon_enabled(void); bool daemon_enabled(void);
void setPValue(unsigned long *val_array, int count); void setPValue(unsigned long *val_array, int count);
inline int get_port_num() const {return sensor_port;}
protected: protected:
// static Parameters *_parameters; // static Parameters *_parameters;
......
This diff is collapsed.
This diff is collapsed.
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