Re: Thread Safety of ODBC Driver

From: "Jason Koeninger" <jkoenin(at)jjcc(dot)com>
To: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
Cc: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Thread Safety of ODBC Driver
Date: 2002-09-09 02:37:41
Message-ID: 20020909024343.90819474E53@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Dave Page 2002-09-09 07:16:38 Re: Thread Safety of ODBC Driver
Previous Message Hiroshi Inoue 2002-09-09 01:59:59 Re: Thread Safety of ODBC Driver