dbTalk Databases Forums  

thread safe

comp.databases.sybase comp.databases.sybase


Discuss thread safe in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
captain biceps
 
Posts: n/a

Default thread safe - 08-03-2004 , 05:21 AM






Hi,
I'm in big trouble..

Did you know if sybase 11.9.2 under NT and/or Linux is thread safe ?
I mean I've done a simple little C program with 2 thread (I use pthread
under the two OS)
to call a sql query...
With 1 thread it's ok, but with 2 libcomn/libtcl crash !!
(all my variable are "thread safe")

even a simple test like :
void *my_thread_fc(...)
{
LOGINREC *login;
DBPROCESS *dbproc;

login = dblogin();

dbsetlname( login, "iso_1", DBSETCHARSET);
dbsetlname( login, "sa", DBSETUSER );
dbsetlname( login, "hst", DBSETHOST );
dbsetlname( login, "", DBSETPWD );

// trouble here...
for(x=0; x<5; x++)
{
dbproc = dbopen( login, "STEA" );
dbclose(dbproc);
}
}

crashes "randomly" into the loop

I don't kown why ?!

please help me... I'm desesperate

thanx guys...





Reply With Quote
  #2  
Old   
Michael Peppler
 
Posts: n/a

Default Re: thread safe - 08-03-2004 , 06:26 AM






On Tue, 03 Aug 2004 12:21:55 +0200, captain biceps wrote:

Quote:
Hi,
I'm in big trouble..

Did you know if sybase 11.9.2 under NT and/or Linux is thread safe ?
I mean I've done a simple little C program with 2 thread (I use pthread
under the two OS)
to call a sql query...
With 1 thread it's ok, but with 2 libcomn/libtcl crash !!
(all my variable are "thread safe")

even a simple test like :
void *my_thread_fc(...)
{
LOGINREC *login;
DBPROCESS *dbproc;

login = dblogin();
You are using DB-Library, which is NOT thread-safe.

Furthermore, the 11.1.1 CT-library (on linux) is not thread-safe either,
though it should be thread-safe on Windows.

On linux/unix you need to link with the _r libraries, BTW.

Michael
--
Michael Peppler Data Migrations, Inc.
mpeppler (AT) peppler (DOT) org http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or
long term contract positions - http://www.peppler.org/resume.html



Reply With Quote
  #3  
Old   
Thomas Gagne
 
Posts: n/a

Default Re: thread safe - 08-03-2004 , 08:14 AM



Michael Peppler wrote:
Quote:
On Tue, 03 Aug 2004 12:21:55 +0200, captain biceps wrote:



You are using DB-Library, which is NOT thread-safe.

Furthermore, the 11.1.1 CT-library (on linux) is not thread-safe either,
though it should be thread-safe on Windows.
Is that with or without the _r you mention below?

Quote:
On linux/unix you need to link with the _r libraries, BTW.

Reply With Quote
  #4  
Old   
Michael Peppler
 
Posts: n/a

Default Re: thread safe - 08-03-2004 , 10:17 AM



On Tue, 03 Aug 2004 09:14:58 -0400, Thomas Gagne wrote:

Quote:
Michael Peppler wrote:
On Tue, 03 Aug 2004 12:21:55 +0200, captain biceps wrote:



You are using DB-Library, which is NOT thread-safe.

Furthermore, the 11.1.1 CT-library (on linux) is not thread-safe either,
though it should be thread-safe on Windows.

Is that with or without the _r you mention below?
Well - I don't have much experience with Windows programing, but I think
that CTlib is always thread-safe on Windows.

Michael
--
Michael Peppler Data Migrations, Inc.
mpeppler (AT) peppler (DOT) org http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or
long term contract positions - http://www.peppler.org/resume.html



Reply With Quote
  #5  
Old   
Neal
 
Posts: n/a

Default Re: thread safe - 08-03-2004 , 12:01 PM



Hello,

You are using the DB-Library API from Open Client and
it is not threadsafe on any platform or version.

The CT-Library API is threadsafe when you link with
the re-entrant libraries (the libraries that follow
the "_r" naming convention). Sybase did not make a
re-entrant set of libraries on Linux until the 12.5
release.

There are a few rules to follow:
http://sybooks.sybase.com/onlinebook...eric__BookView

I would recommend going to the Sybase Product Download
Center and download the 12.5.1 Software Developer's Kit
from here: https://sybase.subscribenet.com

Then get the latest EBF for it from http://downloads.sybase.com

The 12.5.1 SDK can run against older versions of ASE.
Just understand that you can use any features that are
newer than the version of ASE you are running.

Thanks,
Neal

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.