switch thread instead of exiting context, handle EOF

lpm_sleep is always being called from within a thread context, not
from an isr context, therefore it should use thread_yield instead of
cpu_switch_context_exit.

EOF on stdin was not handled before.