Обсуждение: libPQ -Canceling Blocking Calls

Поиск
Список
Период
Сортировка

libPQ -Canceling Blocking Calls

От
Keary Suska
Дата:
Is it possible to use PQcancel() to cancel a blocking call, such as a call
to PQexec?

TIA,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"




Re: libPQ -Canceling Blocking Calls

От
Tom Lane
Дата:
Keary Suska <hierophant@pcisys.net> writes:
> Is it possible to use PQcancel() to cancel a blocking call, such as a call
> to PQexec?

Sure.  Look at psql for an example.  You probably need to call PQcancel
from a signal handler, but there's a signal-safe variant for that.
        regards, tom lane


Re: libPQ -Canceling Blocking Calls

От
Keary Suska
Дата:
7/10/08 3:05 PM, also sprach tgl@sss.pgh.pa.us:

> Sure.  Look at psql for an example.  You probably need to call PQcancel
> from a signal handler, but there's a signal-safe variant for that.

Great. Although I was planning on using a threaded approach, but since libpq
was compiled thread-safe, I assume this would be fine. I was hoping I could
cancel a synchronous call without having to collapse the thread. This is
good news.

Thanks,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"