Hello, Are there any problems with the pthread_rwlock routines ? I see some prototype warning messages on compilation but the programme seems to link OK and, as far as I can tell with a multi-threaded application, seems to work OK. Any recommendations for checking the various possible patterns of mutual interaction between threads in an MT application ?? Using gcc 4.1.1 and libc-2.3.5
Hello, Are there any problems with the pthread_rwlock routines ? I see some prototype warning messages on compilation but the programme seems to link OK and, as far as I can tell with a multi-threaded application, seems to work OK.
Any recommendations for checking the various possible patterns of mutual interaction between threads in an MT application ??
Using gcc 4.1.1 and libc-2.3.5 I am not familiar with "pthread_rwlock". The locks are set using
On Sun, 09 Jul 2006 16:27:30 +0100 peter burden <peter.burden@gmail.com> wrote: pthread_mutex_lock and released using pthread_mutex_unlock. You should be using NPTL threads. Are you including #include <pthread.h> Additionally, threads have different behavior on single vs. multi-processors. And remember, that some Intel chips also have a feature called hyper-threading which effectively simulates a second CPU. Please post the warning messages. You should not have any prototype warnings unless you are passing the wrong type of parameters. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
Jerry Feldman wrote:
On Sun, 09 Jul 2006 16:27:30 +0100 peter burden <peter.burden@gmail.com> wrote:
Hello, Are there any problems with the pthread_rwlock routines ? I see some prototype warning messages on compilation but the programme seems to link OK and, as far as I can tell with a multi-threaded application, seems to work OK.
Any recommendations for checking the various possible patterns of mutual interaction between threads in an MT application ??
Using gcc 4.1.1 and libc-2.3.5
I am not familiar with "pthread_rwlock". The locks are set using pthread_mutex_lock and released using pthread_mutex_unlock.
I'm also using mutex_lock and cond_wait etc., elsewhere in the programme for various other types of synchronisation.
You should be using NPTL threads. Are you including #include <pthread.h> Additionally, threads have different behavior on single vs. multi-processors. And remember, that some Intel chips also have a feature called hyper-threading which effectively simulates a second CPU. Please post the warning messages. You should not have any prototype warnings unless you are passing the wrong type of parameters.
Yes, using NPTL and pthread.h is included. Here's the uname -a output Linux linux 2.6.13-15-default #1 Tue Sep 13 14:56:15 UTC 2005 i686 athlon i386 GNU/Linux Here's the warnings :- gcc -O -c -g -I/home/peter/spider/include -DDEBUG=7 -pthread -DLINUX -funsigned-char -Wall -Wextra -fstack-protector-all -c -o cachegen.o /home/peter/spider/source/cachegen.c /home/peter/spider/source/cachegen.c: In function ‘getfromcache’: /home/peter/spider/source/cachegen.c:157: warning: implicit declaration of function ‘pthread_rwlock_rdlock’ /home/peter/spider/source/cachegen.c:171: warning: implicit declaration of function ‘pthread_rwlock_unlock’ /home/peter/spider/source/cachegen.c:175: warning: implicit declaration of function ‘pthread_rwlock_wrlock’
On Sun, 09 Jul 2006, 19:31:57 +0200, peter burden wrote:
[...] Yes, using NPTL and pthread.h is included. Here's the uname -a output
Linux linux 2.6.13-15-default #1 Tue Sep 13 14:56:15 UTC 2005 i686 athlon i386 GNU/Linux
Here's the warnings :-
gcc -O -c -g -I/home/peter/spider/include -DDEBUG=7 -pthread -DLINUX -funsigned-char -Wall -Wextra -fstack-protector-all -c -o cachegen.o /home/peter/spider/source/cachegen.c /home/peter/spider/source/cachegen.c: In function ‘getfromcache’: /home/peter/spider/source/cachegen.c:157: warning: implicit declaration of function ‘pthread_rwlock_rdlock’ /home/peter/spider/source/cachegen.c:171: warning: implicit declaration of function ‘pthread_rwlock_unlock’ /home/peter/spider/source/cachegen.c:175: warning: implicit declaration of function ‘pthread_rwlock_wrlock’
The prototype declaration is depending on some #define flag which you haven't defined. You should add "-D_XOPEN_SOURCE" to the gcc flags you're using to make the prototype declaration visible. HTH, cheers. l8er manfred
On Sun, 09 Jul 2006 18:31:57 +0100 peter burden <peter.burden@gmail.com> wrote:
Jerry Feldman wrote:
On Sun, 09 Jul 2006 16:27:30 +0100 peter burden <peter.burden@gmail.com> wrote:
I am not familiar with "pthread_rwlock". The locks are set using pthread_mutex_lock and released using pthread_mutex_unlock.
I'm also using mutex_lock and cond_wait etc., elsewhere in the programme for various other types of synchronisation.
gcc -O -c -g -I/home/peter/spider/include -DDEBUG=7 -pthread -DLINUX -funsigned-char -Wall -Wextra -fstack-protector-all -c -o cachegen.o /home/peter/spider/source/cachegen.c /home/peter/spider/source/cachegen.c: In function ‘getfromcache’: /home/peter/spider/source/cachegen.c:157: warning: implicit declaration of function ‘pthread_rwlock_rdlock’ /home/peter/spider/source/cachegen.c:171: warning: implicit declaration of function ‘pthread_rwlock_unlock’ /home/peter/spider/source/cachegen.c:175: warning: implicit declaration of function ‘pthread_rwlock_wrlock’ These are not standard POSIX thread functions, but are Unix 98 functions. Add #define __UNIX98
-- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
On Mon, 10 Jul 2006, 11:28:36 +0200, Per Jessen wrote:
Jerry Feldman wrote:
These are not standard POSIX thread functions, but are Unix 98 functions. Add #define __UNIX98
I use those locking functions too, and just compile with gcc -D_GNU_SOURCE.
FWIW, you can find all the details in /usr/include/features.h; there you see the following comment: /* If _GNU_SOURCE was defined by the user, turn on all the other * features. */ Cheers. l8er manfred
participants (4)
-
Jerry Feldman
-
Manfred Hollstein
-
Per Jessen
-
peter burden