X-Original-To: pgsql-interfaces@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9B0914764C4 for ; Thu, 8 May 2003 03:30:33 -0400 (EDT) Received: from cpc-gw2.cpc.net.au (unknown [210.9.248.93]) by postgresql.org (Postfix) with ESMTP id 620B44764A7 for ; Thu, 8 May 2003 03:30:31 -0400 (EDT) Received: from utiba.com (ser1.cpc.net.au [192.168.0.19]) by Utiba Mail Gateway (2.2.2) with ESMTP id h487UVp30554 for ; Thu, 8 May 2003 17:30:31 +1000 Received: from pc37.cpc.net.au (pc37.cpc.net.au [192.168.0.37]) by Utiba Mail Thingy (0.0.2) with ESMTP id h487UUW09176 for ; Thu, 8 May 2003 17:30:30 +1000 From: Philip Yarra Organization: Utiba To: Subject: ECPG thread-safety test-case Date: Thu, 8 May 2003 17:30:28 +1000 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="------------Boundary-00=_SU4KWY7LGWO4CTLREAA2" Message-Id: <200305081730.28422.philip@utiba.com> X-Spam-Status: No, hits=-12.4 required=5.0 tests=BAYES_01,UPPERCASE_25_50,USER_AGENT_KMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/26 X-Sequence-Number: 4144 --------------Boundary-00=_SU4KWY7LGWO4CTLREAA2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi all, as per conversations around about 2003-04-22, I have put together a= =20 quick app to test the thread-safety issue in ECPG that we hit. I've run thi= s=20 against 7.3.2 with Lee's patch applied, and I still get problems with threa= ds=20 locking up.=20 Would anyone care to give it a try? It would help me to ascertain if the=20 problem still exists, or if it's something I am doing wrong. Regards, Philip Yarra. --------------Boundary-00=_SU4KWY7LGWO4CTLREAA2 Content-Type: text/x-csrc; charset="us-ascii"; name="cn.pgc" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cn.pgc" /* on linux, you can compile with: ecpg cn.pgc&& gcc -I/usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpthread cn.c and you'll need this table: CREATE TABLE foo ( message character(40) ); */ #include int main(); void ins1(); void ins2(); int main() { pthread_t thread1, thread2; pthread_create(&thread1, NULL, (void *) ins1, NULL); pthread_create(&thread2, NULL, (void *) ins2, NULL); pthread_join(thread1, NULL); pthread_join(thread2, NULL); printf("Done!"); return 0; } void ins1() { int i; EXEC SQL BEGIN DECLARE SECTION; char* cs = "test@somehost"; char* bar = "one!"; EXEC SQL END DECLARE SECTION; EXEC SQL WHENEVER sqlerror sqlprint; EXEC SQL CONNECT TO :cs AS test1; EXEC SQL SET AUTOCOMMIT TO ON; for (i = 0; i < 5; i++) { printf("thread1 inserting\n"); EXEC SQL INSERT INTO foo VALUES(:bar); printf("==>thread1 insert done\n"); } EXEC SQL DISCONNECT test1; printf("done!\n"); } void ins2() { int i; EXEC SQL BEGIN DECLARE SECTION; char* cs = "test@somehost"; char* bar = "two!"; EXEC SQL END DECLARE SECTION; EXEC SQL WHENEVER sqlerror sqlprint; EXEC SQL CONNECT TO :cs AS test2; EXEC SQL SET AUTOCOMMIT TO ON; for (i = 0; i < 5; i++) { printf("thread2 inserting\n"); EXEC SQL INSERT INTO foo VALUES(:bar); printf("==>thread2 insert done\n"); } EXEC SQL DISCONNECT test2; printf("done!\n"); } --------------Boundary-00=_SU4KWY7LGWO4CTLREAA2--