Fixed|libcore|Lockable: Issue with the mutex lock counter

When unlocking a Lockable, it was first unlocked and only then its
lock count was decremented. This meant that execution may have
continued elsewhere with an incorrect lock count. Now the lock count
is manipulated only while the Lockable still remains locked.

However, keeping track of the lock count is only relevant in debug
builds, so the counting is now ifdef'ed away in release builds. This
means individual (un)lockings are faster as one doesn't have to lock
and unlock the lock count mutex.
Fixed|libcore|TaskPool: Completing a pool while it is being destroyed

The allTasksDone() signal was emitted after unlocking, which meant that
a destructor waiting on the mutex would get a chance to complete too
early.
Merge branch 'master' into convex-subspace