Opendigitalradio / ODR-DabMod

ODR-DabMod is a DAB (Digital Audio Broadcasting) modulator, part of the ODR-mmbTools.
https://www.opendigitalradio.org
Other
49 stars 32 forks source link

Using C++11 instead of boost #18

Closed piratfm closed 6 years ago

piratfm commented 6 years ago

I have some small modifications, that allows to migrate from boost to C++11 this made for having possibility to compile modulator software for LEDE/OpenWRT, but it's not fully complete (especially for telnet remote control and USRP driver), maybe it will be interesting to finalize it, so embedded devices will have less dependencies.

Here is diff on how it can be done: https://github.com/piratfm/ODR-DabMod/commit/6dc0cdf6679e7ac01f1225c6aabbcef5dfa132c9

mpbraendli commented 6 years ago

Replacing boost with std is welcome, but I'm unhappy about std::thread missing the interrupt() functionality. On my system it is actually necessary otherwise it will not stop properly. It has to be replaced by another way to wake up the sleeping thread. I have a long flight on the 3rd, I'll look into it then. Of course, feel free to push more commits to your boost_to_cpp11 branch, I will follow it (No need to open a new pull request). Thanks!

piratfm commented 6 years ago

Since we already having dependency for posix threads, i'm thinking we can use it for creating threads that must have possibility to cancel like pthread_create() and after that pthtead_cancel(), so exception like in boost will be catched. Just not sure if all of threads must be cancelable.

mpbraendli commented 6 years ago

Not all need to be cancelled. I've already converted most to std, except those that used interrupt().

I guess we can call pthread_cancel on the std::thread native handle, boost is probably doing the same. I wonder however how the cancellation itself gets done, maybe we need to do something special inside the thread function.

I'm OK with assuming pthread, if one day we have to support another thread implementation we'll take care of it then.

PS: License.txt from the INI lib needs to be added. Could you put into lib/ instead of /src to distinguish between our code and 3rd party code?

mpbraendli commented 6 years ago

branch boost_to_cpp11 is now in this repository too, and you have push rights. We can complete this work here.

mpbraendli commented 6 years ago

My assumption that boost uses pthread_cancel was wrong, I checked the boost sources. I am currently wondering "how could it have worked?", and I will have to look into it further.

mpbraendli commented 6 years ago

Review of goals: instead of removing boost completely, make boost optional when building ODR-DabMod for the EasyDABv3, which has part of the processing done in FPGA. This will happen in next and the branch boost_to_cpp11 will not be used anymore.

mpbraendli commented 6 years ago

Branch easydabv3 now compiles without boost.

mpbraendli commented 6 years ago

ODR-DabMod next does not require boost anymore, and the telnet server should now also work for the easydabv3 build, although I didn't try.