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