OpenBTS question


Hey guys,

I wasn’t able to find an OpenBTS mailing list. Let me know if there is
one and I’ll post the question there.

I was looking through the OpenBTS source and was trying to extend it
to decode the waveforms I recorded previously. In the process I
stumbled upon the following in CommonLibs/Threads.h:

~Thread() { assert(!pthread_attr_destroy(&mAttrib)); }

The problem is that the RadioInterface class has 3 Thread members for
the processing that it does. The initialization of the mAttrib field
in Thread happens only when Thread::start() is called. Since I’m not
using the Threads for processing and simply trying to extend the class
and use its methods to process an input file this results in a
segfault when pthread_attr_destroy() is called on the uninitialized
attribute. It seems that moving the pthread_attr_init() call to the
constructor should be the right thing to do. Alternatively, one could
set the mAttrib to some value in the constructor so it can be checked
in the destructor.

Is this correct or am I missing something here? I’ll supply the patch
that initializes mAttrib in the constructor, unless that is not the
preferred way of doing things.