[m-users.] ODBC library, parallel IO

Julien Fischer jfischer at opturion.com
Fri Feb 17 20:04:38 AEDT 2023


On Fri, 17 Feb 2023, Volker Wysk wrote:

> Am Freitag, dem 17.02.2023 um 09:51 +1100 schrieb Julien Fischer:
>
>> Hi Volker,
>
> Hi!
>
>> On Thu, 16 Feb 2023, Volker Wysk wrote:
>>
>>> It seems to me that the ODBC library isn't thread safe, because many
>>> foreigen_proc's aren't declared thead_safe. Is that so?
>>
>> Given the way that code currently uses global state, it isn't thread
>> safe.
>
> That's not so good... Do you have an idea how hard it would be to make it
> thread safe?

I haven't looked in an great detail, but at the least the global
variables in the foreign code block at line 474 would need to be
made thread local.  Also, most of the foreign_procs are implicitly
"not_thread_safe" which means they will acquire the global lock when
called, they would need to be marked as "thread_safe".

> And yesterday, after writing the message, I've found the "-lpthreads" in the
> Mmakefile of the ODBC library. What does it use the the pthreads library
> for, when it isn't thread safe ...? I'm just curious.

The Mercury part isn't thread safe, presumably the underlying ODBC
library is using pthreads in some way and that's why it is required.

Julien.


More information about the users mailing list