If this is just one process, then no, they cannot write at the same time. Greens all work in the same OS thread and are planned together, only one can work at a time.
with open('log', 'w') as log: jobs = [gevent.spawn(log.write, 'event %d' % i) for i in range(10)] gevent.joinall(jobs)
... will cause the potions to be logged one by one.
If you have multiple processes, I suggest logging in to redis or perhaps using zeromq to log into a dedicated daemon. Or use some other external logging daemon.
source share