Fixed mutex deadlock

- Added test code to tenyksctl