"Magnus Hagander" <[EMAIL PROTECTED]> writes: > Here is an attempt at this. First patch contains the changes to libpq, > second patch contains changes to psql to use this API. Docs not updated > yet, pending approval of the general idea at least :)
I think it would be better to dispense with the PQgetCancelError function and just make the signature of PQcancel be int PQcancel(PGcancel *cancel, char *errbuf, int errbuflen); where errbuf would normally point to a local array in the calling function. As-is, PQcancel is itself not thread safe because it is scribbling on the PGcancel struct. I thought the whole point of this exercise was to allow multiple threads to use the PGcancel struct; which seems to me to imply that it had better be read-only to PQcancel. We don't need the cancelConnLock if this is done properly (at least, assuming that storing a pointer is atomic, which seems reasonable). regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster