check pthread_rwlockattr_getkind_np for porting
parent
013b7888ea
commit
a39005253b
2
INSTALL
2
INSTALL
|
|
@ -12,6 +12,6 @@ Chinese language: http://www.fastken.com/
|
|||
# the command lines as:
|
||||
|
||||
git clone https://github.com/happyfish100/libfastcommon.git
|
||||
cd libfastcommon; git checkout V1.0.48
|
||||
cd libfastcommon; git checkout V1.0.55
|
||||
./make.sh clean && ./make.sh && ./make.sh install
|
||||
|
||||
|
|
|
|||
23
make.sh
23
make.sh
|
|
@ -138,10 +138,29 @@ cat <<EOF > src/_os_define.h
|
|||
#endif
|
||||
EOF
|
||||
|
||||
if [ -f /usr/lib/libpthread.so ] || [ -f /usr/local/lib/libpthread.so ] || [ -f /usr/lib64/libpthread.so ] || [ -f /usr/lib/libpthread.a ] || [ -f /usr/local/lib/libpthread.a ] || [ -f /usr/lib64/libpthread.a ]; then
|
||||
pthread_path=''
|
||||
for path in /lib /lib64 /usr/lib /usr/lib64 /usr/local/lib; do
|
||||
if [ -d $path ]; then
|
||||
pthread_path=$(find $path -name libpthread.so | head -n 1)
|
||||
if [ -n "$pthread_path" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
pthread_path=$(find $path -name libpthread.a | head -n 1)
|
||||
if [ -n "$pthread_path" ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$pthread_path" ]; then
|
||||
LIBS="$LIBS -lpthread"
|
||||
line=$(nm $pthread_path | fgrep pthread_rwlockattr_getkind_np | fgrep -w T)
|
||||
if [ -n "$line" ]; then
|
||||
CFLAGS="$CFLAGS -DWITH_PTHREAD_RWLOCKATTR_GETKIND_NP=1"
|
||||
fi
|
||||
elif [ -f /usr/lib/libc_r.so ]; then
|
||||
line=`nm -D /usr/lib/libc_r.so | grep pthread_create | grep -w T`
|
||||
line=$(nm -D /usr/lib/libc_r.so | grep pthread_create | grep -w T)
|
||||
if [ -n "$line" ]; then
|
||||
LIBS="$LIBS -lc_r"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ int init_pthread_rwlock(pthread_rwlock_t *rwlock)
|
|||
int result;
|
||||
|
||||
|
||||
#ifdef OS_LINUX
|
||||
#ifdef WITH_PTHREAD_RWLOCKATTR_GETKIND_NP
|
||||
attr.ptr = &attr.holder;
|
||||
if ((result=pthread_rwlockattr_init(attr.ptr)) != 0) {
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
|
|
|
|||
Loading…
Reference in New Issue