Forums

Can webworkers share a multiprocessing Lock?

Can multiple webworkers share a multiprocessing Lock? (As I have no paid account yet, I cannot try it out).

As far as I know, it depends on how the processes are spawned (e.g. using fork or not). On gunicorn, it depends on a commandline flag (see https://stackoverflow.com/a/18253943/5069869).

So are multiple webworkers on pythonanywhere spawned in a way that they can share a Lock?

The webworkers are on the same machine, so I do know that acquiring a lock like this works. Let me investigate the multiprocess.lock as well.