Migrate idle-action-thread to 0.9 branch

See #149 for more background on this.
Add also a sleeptime parameter, that enable the idle sleep
when set to 0. Default value is 1 to match the actual behavior.