Re: [gnome-db] Threads.

Bas Driessen <[email protected]>
Newsgroups gmane.comp.gnome.db
Organization Xobas Software
Message-ID <[email protected]>

On Fri, 2009-07-24 at 13:51 +0200, Vivien Malerba wrote:

> 
> 
> 
> 2009/7/24 Bas Driessen <[email protected]>
> 
>         Hello,
>         
>         Question regarding libgda and threads.
>         
>         I open a data source connection (ie:
>         gda_connection_open_from_dsn) in thread 1 and then I try to
>         perform any action on the connection (ie:
>         gda_connection_statement_execute_select) in thread 2. If I do
>         this in Postgresql all works fine. If I try to do this in
>         MySQL then the system appears to hang in thread 2. I assume
>         because thread 1 is holding a lock on the connection. 
>         
>         How can I remove the lock that is set by function
>         gda_connection_open_from_dsn so I can access the connection
>         information from thread 2?
>         
>         Perhaps slightly out of libgda scope, but is there a
>         difference between Postgresql and MySQL when it comes to
>         threads and locking? It appears that Postgresql does not have
>         that concept or perhaps by default configured not to use
>         threads?
>         
> 
> The same kind of limitation also applies to PostgreSQL which is
> usually not compiled with thread support in client libraries. The
> discrepancies between databases' client libraries regarding threads
> have led me to create the GDA_CONNECTION_OPTIONS_THREAD_SAFE flag (in
> 4.1, not in 4.0) where a connection can be used by any thread,
> regardless of the thread which created the connection (in fact a
> thread is created per connection and the user threads synchronize with
> that thread when running statements, it relies on the GdaThreadWrapper
> object).


My previous message crossed this one. So if I understand correctly,  in
fact my Postgresql is NOT thread safe and therefore it is working and
the MySQL IS thread safe and therefore it is "hanging" on a lock.

How/where can I set this GDA_CONNECTION_OPTIONS_THREAD_SAFE flag in 4.1?

Is there any workaround/solution in 4.0? Any chance to add this flag in
4.0 or will that break any API rules etc?

Thanks,
Bas.

_______________________________________________
gnome-db-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-db-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.