Skip to content

Commit 9cd6770

Browse files
author
Herbert KOELMAN
committed
Merge branch 'develop' of mut-mut-scmv1.dev.parimutuel.local:p094212/cpp-pthread into develop
2 parents 8d6b8d1 + 86096af commit 9cd6770

File tree

4 files changed

+66
-11
lines changed

4 files changed

+66
-11
lines changed

Makefile.in

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
#
55

66
prefix=@prefix@
7+
exec_prefix=@exec_prefix@
8+
INCLUDEDIR=@includedir@/pthread
9+
LIBDIR=@libdir@
10+
LOCALEDIR=@localedir@
711

812
INSTALL=@INSTALL@
9-
LOCALEDIR=@localedir@
1013
RM=@RM@
1114
MKDIR=@MKDIR_P@
1215
PACKAGE=@PACKAGE_NAME@-@PACKAGE_VERSION@-@[email protected]
@@ -17,7 +20,7 @@ CODECHECK=@CODECHECK@
1720
PTHREADLIB=libcpp-pthread.a
1821

1922
all:
20-
cd src && $(MAKE) clean all
23+
cd src && $(MAKE)
2124

2225
pkg:
2326
$(MKDIR) distrib
@@ -40,11 +43,10 @@ doxygen:
4043
${DOXYGEN} doxyfile
4144

4245
install:
43-
$(MKDIR) ${prefix}/include/pthread
44-
$(MKDIR) ${prefix}/lib/pthread
45-
$(INSTALL) ${HEADERS} ${prefix}/include/pthread
46-
$(INSTALL) lib/libcpp-pthread.a ${prefix}/lib/
46+
$(MKDIR) $(INCLUDEDIR)
47+
cd include/pthread && $(INSTALL) *.hpp *.h $(INCLUDEDIR)
48+
$(INSTALL) lib/$(PTHREADLIB) @libdir@
4749

4850
uninstall:
49-
$(RM) -R ${prefix}/include/pthread
50-
$(RM) ${prefix}/lib/libcpp-pthread.a
51+
$(RM) -R $(INCLUDEDIR)
52+
$(RM) @libdir@/$(PTHREADLIB)

configure

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ ac_subst_vars='LTLIBOBJS
589589
LIBOBJS
590590
subdirs
591591
HEADERS
592+
MKDIR_P
592593
DOXYGEN
593594
RM
594595
INSTALL_DATA
@@ -1948,6 +1949,48 @@ $as_echo "no" >&6; }
19481949
fi
19491950
19501951
1952+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
1953+
$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
1954+
if test -z "$MKDIR_P"; then
1955+
if ${ac_cv_path_mkdir+:} false; then :
1956+
$as_echo_n "(cached) " >&6
1957+
else
1958+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1959+
for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
1960+
do
1961+
IFS=$as_save_IFS
1962+
test -z "$as_dir" && as_dir=.
1963+
for ac_prog in mkdir gmkdir; do
1964+
for ac_exec_ext in '' $ac_executable_extensions; do
1965+
as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
1966+
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
1967+
'mkdir (GNU coreutils) '* | \
1968+
'mkdir (coreutils) '* | \
1969+
'mkdir (fileutils) '4.1*)
1970+
ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
1971+
break 3;;
1972+
esac
1973+
done
1974+
done
1975+
done
1976+
IFS=$as_save_IFS
1977+
1978+
fi
1979+
1980+
test -d ./--version && rmdir ./--version
1981+
if test "${ac_cv_path_mkdir+set}" = set; then
1982+
MKDIR_P="$ac_cv_path_mkdir -p"
1983+
else
1984+
# As a last resort, use the slow shell script. Don't cache a
1985+
# value for MKDIR_P within a source directory, because that will
1986+
# break other packages using the cache if that directory is
1987+
# removed, or if the value is a relative name.
1988+
MKDIR_P="$ac_install_sh -d"
1989+
fi
1990+
fi
1991+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
1992+
$as_echo "$MKDIR_P" >&6; }
1993+
19511994
19521995
# Okay, no cppcheck found, maybe we have sonar
19531996
if test -z "$CODECHECK"
@@ -2665,6 +2708,7 @@ gives unlimited permission to copy, distribute and modify it."
26652708
ac_pwd='$ac_pwd'
26662709
srcdir='$srcdir'
26672710
INSTALL='$INSTALL'
2711+
MKDIR_P='$MKDIR_P'
26682712
test -n "\$AWK" || AWK=awk
26692713
_ACEOF
26702714
@@ -3105,6 +3149,11 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
31053149
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
31063150
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
31073151
esac
3152+
ac_MKDIR_P=$MKDIR_P
3153+
case $MKDIR_P in
3154+
[\\/$]* | ?:[\\/]* ) ;;
3155+
*/*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
3156+
esac
31083157
_ACEOF
31093158
31103159
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -3159,6 +3208,7 @@ s&@builddir@&$ac_builddir&;t t
31593208
s&@abs_builddir@&$ac_abs_builddir&;t t
31603209
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
31613210
s&@INSTALL@&$ac_INSTALL&;t t
3211+
s&@MKDIR_P@&$ac_MKDIR_P&;t t
31623212
$ac_datarootdir_hack
31633213
"
31643214
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ AC_ARG_ENABLE([codecheck], \
1717
AC_PROG_INSTALL
1818
AC_CHECK_PROG([RM],[rm],[rm -f])
1919
AC_CHECK_PROG([DOXYGEN],[doxygen],[doxygen],[echo \"please install doxygen and re-run ./configure, or run it manualy doxygen \"])
20+
AC_PROG_MKDIR_P
2021

2122
# Okay, no cppcheck found, maybe we have sonar
2223
if test -z "$CODECHECK"

src/thread.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,14 @@ namespace pthread {
128128
std::swap(_status, other._status);
129129
}
130130

131-
abstract_thread::abstract_thread(const std::size_t stack_size): _stack_size(stack_size){
131+
abstract_thread::abstract_thread(const std::size_t stack_size): _stack_size(stack_size), _thread(NULL){
132132
}
133133

134134
abstract_thread::~abstract_thread(){
135135

136-
delete _thread;
136+
if ( _thread != NULL ){
137+
delete _thread;
138+
}
137139
}
138140

139141
void abstract_thread::start(){
@@ -174,7 +176,7 @@ namespace pthread {
174176
pat->join();
175177
} catch ( pthread_exception &err ){
176178
printf("thread_group destructor failed to join one thread. %s, (%d) %s.\n", err.what(), err.pthread_errno(), err.pthread_errmsg());
177-
} catch ( ... ){ //NOSONAR this was done on purpose to avoid crashes due to unhandled error conditions
179+
} catch ( ... ){ //NOSONAR this was done on purpose to avoid crashes due to unhandled error conditions. This should never happen.
178180
printf("thread_group destructor received an unexpected exception when joining threads.");
179181
};
180182
}

0 commit comments

Comments
 (0)