refactored child_io_loop to allow multi-thread refreshing

now all the relevant variables to refresh timing are stored
in the module structure (which is synchronized by mutex) so
that a thread besides the IO loop thread can cause a refresh
to happen.
implemented termina_input and terminal_input_chars api calls

still working on testing it properly