moved thread.c example file, added flush_buffer function file