Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id B024B9FB83A for ; Thu, 19 Jul 2007 08:01:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 19018-03 for ; Thu, 19 Jul 2007 08:01:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 305A49FB5FA for ; Thu, 19 Jul 2007 08:01:20 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0177E33F66; Thu, 19 Jul 2007 13:01:17 +0200 (MET DST) From: "Ender" X-Newsgroups: pgsql.interfaces Subject: PQcancel hangs Date: Thu, 19 Jul 2007 17:01:29 +0600 Organization: Home Lines: 46 Message-ID: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 To: pgsql-interfaces@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200707/4 X-Sequence-Number: 6588 Hi, all. I'm trying to cancel query that i'm executing. In the first thread i'm execute query through PQexec function. Then i'm trying to break it's execution. From the second thread i'm execute PQgetCancel, PQcancel, PQfreeCancel. The execution of PQexec get interrupted, however PQcancel never return control to program. The execution of PQexec in the first thread get interrupted, however in the second thread no code executed beyond this line: Result:=ZPlainPostgreSql8.PQCancel(Cancel,lpszErrBuf,BufSize)=1; PQCancel never return control to caller. Is it supposed to work at all? Code sample (Delphi - ZeosDBO): function TZPostgreSQL8PlainDriver.RequestCancelEx(Handle: PZPostgreSQLConnect; out ErrorMessage: String): Boolean; const BufSize=256; var Cancel:PPGCancel; {actually Pointer} lpszErrBuf:PAnsiChar; begin Result:=FALSE; ErrorMessage:=''; Cancel:=ZPlainPostgreSql8.PQgetCancel(Handle); if Cancel=NIL then Exit; try lpszErrBuf:=StrAlloc(BufSize); try FillChar(lpszErrBuf^,BufSize,0); Result:=ZPlainPostgreSql8.PQCancel(Cancel,lpszErrBuf,BufSize)=1; if not Result then ErrorMessage:=StrPas(lpszErrBuf); finally StrDispose(lpszErrBuf); end; finally ZPlainPostgreSql8.PQfreeCancel(Cancel); end; end;