dbTalk Databases Forums  

ct-libraries and POSIX threads

comp.databases.sybase comp.databases.sybase


Discuss ct-libraries and POSIX threads in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Amol Natekar
 
Posts: n/a

Default ct-libraries and POSIX threads - 09-14-2004 , 12:33 AM






HI all,
I have been trying to program sybase ct-libraries for solaris in
a multithreaded environment. But whenever I try to run this program i
get a core dump. Can anyone help me to find some examples or documents
of how to program ct-libraries under POSIX thread environment or for
native threads. I have been using "one thread one connection" model to
keep it simple. Does anyone know why this problem occurs.

I have complied the file using the following options.

[PYTHON:sybaseiq:/export/home/sybaseiq/amol/amol/multhrdmyprog]gcc -g
usingquery.c -o usingquery -I /export/home/sybaseiq/ociq-12_0/include
-L /export/home/sybaseiq/ociq-12_0/lib -lpthread -lcs -lct -lcomn
-lsybdb -ltcl --D_REENTRANT -D_THREAD_SAFE

The stack trace that is generated from the core is given below..
[PYTHON:sybaseiq:/export/home/sybaseiq/amol/amol/multhrdmyprog]gdb
../usingquery core

Core was generated by `./usingquery'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libpthread.so.1...done.
Loaded symbols for /usr/lib/libpthread.so.1
Reading symbols from
/export/home/sybaseiq/ociq-12_0/lib/libcs.so...done.
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libcs.so
Reading symbols from
/export/home/sybaseiq/ociq-12_0/lib/libct.so...done.
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libct.so
Reading symbols from
/export/home/sybaseiq/ociq-12_0/lib/libcomn.so...done.
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libcomn.so
Reading symbols from
/export/home/sybaseiq/ociq-12_0/lib/libsybdb.so...done.
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libsybdb.so
Reading symbols from
/export/home/sybaseiq/ociq-12_0/lib/libtcl.so...done.
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libtcl.so
Reading symbols from /usr/lib/libthread.so.1...done.
Loaded symbols for /usr/lib/libthread.so.1
Reading symbols from /usr/lib/libc.so.1...done.
Loaded symbols for /usr/lib/libc.so.1
Reading symbols from /usr/lib/libsocket.so.1...done.
Loaded symbols for /usr/lib/libsocket.so.1
Reading symbols from /usr/lib/libdl.so.1...done.
Loaded symbols for /usr/lib/libdl.so.1
Reading symbols from /usr/lib/libnsl.so.1...done.
Loaded symbols for /usr/lib/libnsl.so.1
Reading symbols from /usr/lib/libmp.so.2...done.
Loaded symbols for /usr/lib/libmp.so.2
Reading symbols from /usr/platform/SUNW,Ultra-80/lib/libc_p
Loaded symbols for /usr/platform/SUNW,Ultra-80/lib/libc_psr
Reading symbols from /export/home/sybaseiq/ociq-12_0/lib/li
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libi
Reading symbols from /export/home/sybaseiq/ociq-12_0/lib/li
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libt
---Type <return> to continue, or q <return> to quit---
#0 0xff0deb24 in netp_checkextfds () from /export/home/syb
((gdb) where
#0 0xff0deb24 in netp_checkextfds () from /export/home/syb
#1 0xff0dbd78 in netp_callback_poll () from /export/home/s
#2 0xff0d13c4 in syb_net_callback () from /export/home/syb
(gdb)


Waiting eagerly for your reply

Regards,
Amol

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

Default Re: ct-libraries and POSIX threads - 09-14-2004 , 01:07 AM






On Mon, 13 Sep 2004 22:33:35 -0700, Amol Natekar wrote:

Quote:
HI all,
I have been trying to program sybase ct-libraries for solaris in
a multithreaded environment. But whenever I try to run this program i
get a core dump. Can anyone help me to find some examples or documents
of how to program ct-libraries under POSIX thread environment or for
native threads. I have been using "one thread one connection" model to
keep it simple. Does anyone know why this problem occurs.

I have complied the file using the following options.

[PYTHON:sybaseiq:/export/home/sybaseiq/amol/amol/multhrdmyprog]gcc -g
usingquery.c -o usingquery -I /export/home/sybaseiq/ociq-12_0/include
-L /export/home/sybaseiq/ociq-12_0/lib -lpthread -lcs -lct -lcomn
-lsybdb -ltcl --D_REENTRANT -D_THREAD_SAFE
You need to use the Sybase _r libraries.

Also - does your program use DB-Library at all? If it does then you need
to be very careful as DB-Lib is NOT threadsafe (I say this because I
notice the -lsybdb on the link line, above.)

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   
Brian Ceccarelli
 
Posts: n/a

Default Re: ct-libraries and POSIX threads - 09-15-2004 , 09:12 AM



Amol,

Version 12.0 of Sybase's ct library does not use posix threads but
Solaris threads. You would need to link to -lthread.

Version 12.5 of Sybase's ct library uses posix threads.

You are using the gcc compiler. GNU likes posix threads.

For thread-safe Sybase libraries, you must link
with -lct_r, -lcs_r -lcomn_r -lsybtcl_r -lintl_r.

-D_REENTRANT is a Solaris thread declaration. It is not a posix
thread definition. You only use -D_REENTRANT if you want Solaris threads.

You have a double dash with --D_REENTRANT. There is no double dash.

If you want your entire Solaris C/C++ program to be posix compliant
(use posix threads under the covers), compile with -D_POSIX_C_SOURCE=199506L


Brian Ceccarelli
http://www.dbpowersuite.com




"Amol Natekar" <amol.natekar (AT) exact-solutions (DOT) com> wrote

Quote:
HI all,
I have been trying to program sybase ct-libraries for solaris in
a multithreaded environment. But whenever I try to run this program i
get a core dump. Can anyone help me to find some examples or documents
of how to program ct-libraries under POSIX thread environment or for
native threads. I have been using "one thread one connection" model to
keep it simple. Does anyone know why this problem occurs.

I have complied the file using the following options.

[PYTHON:sybaseiq:/export/home/sybaseiq/amol/amol/multhrdmyprog]gcc -g
usingquery.c -o usingquery -I /export/home/sybaseiq/ociq-12_0/include
-L /export/home/sybaseiq/ociq-12_0/lib -lpthread -lcs -lct -lcomn
-lsybdb -ltcl --D_REENTRANT -D_THREAD_SAFE

The stack trace that is generated from the core is given below..
[PYTHON:sybaseiq:/export/home/sybaseiq/amol/amol/multhrdmyprog]gdb
./usingquery core

Core was generated by `./usingquery'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libpthread.so.1...done.
Loaded symbols for /usr/lib/libpthread.so.1
Reading symbols from
/export/home/sybaseiq/ociq-12_0/lib/libcs.so...done.
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libcs.so
Reading symbols from
/export/home/sybaseiq/ociq-12_0/lib/libct.so...done.
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libct.so
Reading symbols from
/export/home/sybaseiq/ociq-12_0/lib/libcomn.so...done.
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libcomn.so
Reading symbols from
/export/home/sybaseiq/ociq-12_0/lib/libsybdb.so...done.
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libsybdb.so
Reading symbols from
/export/home/sybaseiq/ociq-12_0/lib/libtcl.so...done.
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libtcl.so
Reading symbols from /usr/lib/libthread.so.1...done.
Loaded symbols for /usr/lib/libthread.so.1
Reading symbols from /usr/lib/libc.so.1...done.
Loaded symbols for /usr/lib/libc.so.1
Reading symbols from /usr/lib/libsocket.so.1...done.
Loaded symbols for /usr/lib/libsocket.so.1
Reading symbols from /usr/lib/libdl.so.1...done.
Loaded symbols for /usr/lib/libdl.so.1
Reading symbols from /usr/lib/libnsl.so.1...done.
Loaded symbols for /usr/lib/libnsl.so.1
Reading symbols from /usr/lib/libmp.so.2...done.
Loaded symbols for /usr/lib/libmp.so.2
Reading symbols from /usr/platform/SUNW,Ultra-80/lib/libc_p
Loaded symbols for /usr/platform/SUNW,Ultra-80/lib/libc_psr
Reading symbols from /export/home/sybaseiq/ociq-12_0/lib/li
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libi
Reading symbols from /export/home/sybaseiq/ociq-12_0/lib/li
Loaded symbols for /export/home/sybaseiq/ociq-12_0/lib/libt
---Type <return> to continue, or q <return> to quit---
#0 0xff0deb24 in netp_checkextfds () from /export/home/syb
((gdb) where
#0 0xff0deb24 in netp_checkextfds () from /export/home/syb
#1 0xff0dbd78 in netp_callback_poll () from /export/home/s
#2 0xff0d13c4 in syb_net_callback () from /export/home/syb
(gdb)


Waiting eagerly for your reply

Regards,
Amol



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.