about thread

From: captain biceps (spe_at_x-media.fr)
Date: 08/16/04


Date: Mon, 16 Aug 2004 21:19:22 +0200

Hi,

I have to use an oracle/sybase driver into a C program.
It's a little serveur which wait incoming connection then fork each client
and create a db connection.

classic...
But now, I must develop under Linux AND Windows, and -of course- win32
doesn't support fork()

So, Thread seems to be a cool solution...
but -it was to easy :)- the version of sybase (and Oracle too I think) isn't
thread-safe.

So I was thinking...

In my thread function, If I load dynamically all the .so to instance them...
eg:

// each thread for each client
fct_threaded(void *...)
{
  hdl = dlopen( db_sybora.so... );
  ptr1 = dlsym(hdl, ....);
  ptr2 = dlsym(hdl, ...);

  //
  ptr1(...)
  etc...

}

Do you think it's a good solution ?
Better idea ?

thanx guys...



Relevant Pages

  • thead
    ... I have to use an oracle/sybase driver into a C program. ... It's a little serveur which wait incoming connection then fork each client ...
    (comp.unix.programmer)
  • Re: why to use select()?
    ... to handle multiple clients, I fork a child, so each child process ... There's only a compelling reason to fork for each client if there is intensive computations to ... most of the early web servers used this forking design. ...
    (comp.unix.programmer)
  • Re: rsync for OpenVMS?
    ... Overcome the fork() issue. ... On the client, it does two things. ... One is it spawns it self, ... The server forks a receiving thread like the client. ...
    (comp.os.vms)
  • Re: Threaded chat server
    ... Typically, an IO::Select server, is preferred, because it handles ... Alternatively, to forking, you can spawn threads to handle each client. ... handed the client socket filehandle, and you can just use IO::Socket ... that fork and use IO::Select. ...
    (perl.beginners)
  • TCP connect problem.
    ... My server does a listen/accept pair for an incoming connection. ... time as the client is calling 'connect'. ...
    (comp.os.linux.networking)