laser-lines: fix calculation of bearing direction

We discovered this during the RoboLab demo. Apparently it was not
committed and thus did not make it into the transition of the plugin
into the core repo.
threading: unlock loop_mutex when default loop() calls pthread_exit()

This is relevant if the user does not provide a loop() method and
Thread::loop() is used.
The thread exits at that point, which means that Thread::run() never gets
to unlock the loop_mutex. This leads to a deadlock when
Thread:::prepare_finalize() wants to lock loop_mutex.

Of course this deadlock can be "avoided" by set_prepfin_conc_loop(true),
but this is not a proper solution.

Took me quite some time to debug this and figure out why my plugin would
not unload after making the transition from BLOCKED_TIMING to CONTINUOUS.
I hope this is the/a proper solution.
Merge remote-tracking branch 'origin/bahram/laser-lines_bearing_fix'
Merge remote-tracking branch 'origin/bahram/thread_loop_mutex'