Yeah, I have doubts on how thread safe writeln is too.
It isn't. At least, not in 3.0.2 on windows. No reason to panic though, just garbled output and/or output in wrong order.
See also logger attachment with example in
this post. (sorry for the faulty critical section: there should be as many as there are calls to writeln or code should be re-arranged to have only one overloaded function that actually calls writeln).
Just remove/comment the threadsafe define and run the example a couple of times to see where/how things go wrong.