pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brendan Rempel <rempelb@cybersoft.ab.ca>
To: pgsql-interfaces@postgresql.org
Subject: pThread and libpq problem
Date: Tue, 25 Aug 1998 12:25:18 -0600
Message-ID: <35E3018E.17736CEA@cybersoft.ab.ca> (raw)

Hello,

I just started using libpq.  I got a single process accessing and
quering a database without a hitch.  But when I copied the code to a
pthread callback function, I get an immediate "segmentation fault"
(running under Red-Hat Linux release 5.0 on i586).  I thinned out all
the necessary code to reproduce this error and tracked it down to a
single call:

void *server(void *arg)
{
   PGconn conn = PQsetdb(pghostNull, pgportNull, pgoptionsNull,
pgttyNull,DbName);
   ...

This code has no problems running in a single threaded executable.  I
read back issues of this mailing list and found several people using
libpq in multithreaded programs, so I am probably doing something
obviously wrong.  I don't know if it matters, but I am using C++ with
libpq C library.  But if anybody can help me, it would be appreciated.

Thanks in advance,

Brendan




Message-ID: <35E3018E.17736CEA@cybersoft.ab.ca>
Permalink:  ../35E3018E.17736CEA@cybersoft.ab.ca/
Also on:    postgresql.org/message-id/35E3018E.17736CEA@cybersoft.ab.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: rempelb@cybersoft.ab.ca
  Subject: Re: pThread and libpq problem
  In-Reply-To: <35E3018E.17736CEA@cybersoft.ab.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox