LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-29-2004, 12:11 PM   #1
marri
Member
 
Registered: May 2004
Posts: 38

Rep: Reputation: 15
using libpq and processes


hi
I have been trying to use the Postgresql library (libpq.so) and processes in my program.
The scenario is like that:

I have made a small shared library where I wrapp the Postgresql functions.

I then call those library functions (my library) from my program.

The program is to behave as a deamon so it is in a endless while loop.

The program starts by opening a connection to the database, enter the while loop and then run some functions.

After that it forks many childs which then call one function from the library I made.

After one round the program goes to sleep and wakes up again one minute later.

Now comes the problem:: If I call the same the same functions again, those within the while loop (not the connection call) I get a get an error return.

It is as if the handle to the connection is not valid any more.

I have checked the program without forking and that works fine.

So my question is what can be done to share a library within processes so they are not duplicating the library includes and so on.

regards
 
Old 10-29-2004, 01:07 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
I think you need to use asynchronous mode. Look here: http://www.postgresql.org/docs/7.4/s...bpq-async.html
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How many processes does everyone have? Furlinastis Slackware 22 09-26-2005 02:53 AM
KDE 3.4 libpq.so.3 error on fedora core 3 volekvolek Fedora 2 03-26-2005 02:01 AM
To many #*$!$@!%! Processes! vaderj Linux - General 4 01-01-2005 10:31 PM
monitoring active processes and identifying the required processes. gajaykrishnan Programming 2 08-13-2004 01:58 AM
libpq.so.2 laasunde Linux - General 1 11-17-2002 05:49 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration