Want Threadsafe operation by default

Issue #15 new
James Powell repo owner created an issue

Currently, there is an option, “Force UI Thread (T)” that is default True, and makes all calls in teh UI thread.

There is a code note: sometimes even if lib was compiled as threadsafecalling in "any thread" can cause crash (both on Windows and Linux RT)”

Also, looking at https://www.postgresql.org/docs/9.6/libpq-threading.html, there is a note: “One thread restriction is that no two threads attempt to manipulate the same PGconn object at the same time. In particular, you cannot issue concurrent commands from different threads through the same connection object. (If you need to run concurrent commands, use multiple connections.)”

One would not normally use the same Connection in parallel calls (at least, I wouldn’t), but there is nothing stopping someone doing this. Would like there to be some kind of lock on the individual connections.

Comments (1)

  1. Patrick Irvin

    Latest source includes libpq v17; documentation states “As of version 17 libpq is always reentrant and thread-safe.” But the restriction remains “ that no two threads attempt to manipulate the same PGconn object at the same time“, so I think the desire for a lock is still valid?

  2. Log in to comment