Re: Thread Safety of ODBC Driver - Mailing list pgsql-odbc

From Jason Koeninger
Subject Re: Thread Safety of ODBC Driver
Date
Msg-id 20020909024343.90819474E53@postgresql.org
Whole thread Raw
In response to Re: Thread Safety of ODBC Driver  (Hiroshi Inoue <Inoue@tpf.co.jp>)
List pgsql-odbc
On Mon, 09 Sep 2002 10:59:59 +0900, Hiroshi Inoue wrote:

>I've developped psqlodbc mainly from Windows side.
>I've planned a trial thread-safe implementation
>under Windows.

Ahh...thanks for the information.  I was coming completely from
the Unix side and wasn't thinking at all about Windows....as you
noticed.

>As for unix I knew about a few xxx_r functions but
>I don't know details about it and unfortunately
>there's no developper from unix side.

Looks like it will probably be me then...  ;->

>Jason Koeninger wrote:
>>
>> execute.c:  Uses the conns global in PGAPI_Transact.
>
>My plan under Windows is to use CriticalSection to serialize
>the access to conns global.

That's probably the most straightforward approach on Windows, but
I don't believe there's an equivalent on Unix.  We'll probably have to
use System V semaphores or Pthread mutexes.

>gpps.c is used with neither iDOBC nor unixODBC.
>I have no interest for standalone driver.

Thanks for the heads up.  I was in a hurry and just read every .c and
.h file not paying attention to whether or not they were actually used.
Needless to say, I found it odd that the driver would have its own
ini file functions.

>> misc.c:  Also has some getpwuid and getuid calls.  mylog and
>> qlog probably need to be serialized, but they shouldn't cause a
>> crash.
>
>I would also use another CriticalSection to serialize the
>access to mylog or qlog.

Critical sections are reliable ways to move from single to multi-threaded
support for functions that have to be serialized, but given the number of
times both functions are called in the code, it might be worthwhile to
consider other options (log thread or semaphores).  For client applications,
I don't see it being a huge issue.

>*nixes, the *make* may be broken. I'm happy if you
>can figure out how to manage it together with
>the thread-safe option.

I'll look more closely at the compile issues as I have time and see what
I can figure out.  I read the GBorg page the other day, but I'll go back
and take a look at the procedures for submitting patches.

Best Regards,

Jason Koeninger
J&J Computer Consulting
http://www.jjcc.com



pgsql-odbc by date:

Previous
From: Hiroshi Inoue
Date:
Subject: Re: Thread Safety of ODBC Driver
Next
From: "Dave Page"
Date:
Subject: Re: Thread Safety of ODBC Driver