> > And if this is a "wrong way" of doing this thing, could someone tell me how > > it should be.. > > You probably want to guard the output with mutexes or semaphores. > Writing unsynchronized to a stream has always unexpected results. Even then it won't necessarily work. textrec threadvar problem.