Skip to content

Commit 52500dd

Browse files
Merge branch 'develop' of https://github.com/HerbertKoelman/cpp-pthread into develop
2 parents 82b204b + 1fb6bcd commit 52500dd

File tree

14 files changed

+47
-39
lines changed

14 files changed

+47
-39
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*.mod
1818

1919
# Compiled Static libraries
20+
*.dSYM
2021
*.lai
2122
*.la
2223
*.a
@@ -26,6 +27,8 @@
2627
*.exe
2728
*.out
2829
*.app
30+
without-cpp11-pthread-tests
31+
with-cpp11-pthread-tests
2932

3033
# Xcode
3134
#cpp-pthread.xcodeproj/

Makefile.in

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ PTHREADLIB=libcpp-pthread.a
1717
all:
1818
cd src && $(MAKE) clean all
1919

20-
dist:
21-
cd src && $(MAKE) dist
22-
tar cf - bin udataobj locale doc | gzip -c > distrib/$(PACKAGE)
20+
pkg:
21+
tar cf - ./ | gzip -c > distrib/$(PACKAGE)
2322

2423
globber:clean
25-
$(RM) -R Makefile autom4te.cache config.log config.status configure
26-
cd src && $(MAKE) globber
24+
-$(RM) -R Makefile autom4te.cache config.log config.status
25+
-(cd src && $(MAKE) globber)
2726

2827
clean:
2928
cd src && $(MAKE) clean

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,25 @@ Install moves files into your system's default localtion of headers and librarie
1616
configure --prefix=/usr/local
1717
```
1818

19-
[Documentation](http://herbertkoelman.github.io/cpp-pthread/doc/html/) can be generated with this command:
19+
[Doxygen documentation](http://herbertkoelman.github.io/cpp-pthread/doc/html/) can be generated with this command:
2020
```
2121
make doxygen
2222
...
2323
```
2424

25+
The target `pkg` will produce au tar.gz.
26+
2527
This command creates a `doc` directory wich will contain the generated documentation.
2628

2729
> **warning** generating documentation requires that doxygen is installed.
2830
31+
The confugre file is not versionned, therefore it is required to run `autoconf` to generate one
32+
```
33+
autoconf
34+
( cd src && autoconf )
35+
( cd tests && autoconf )
36+
```
37+
2938
### How to use it
3039

3140
Once compiled and installed in a location that suites you, use your compiler options to reference the headers and the libraries directory. In almoast all casses you can:

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Process this file with autoconf to produce a configure script.
33

44
AC_PREREQ(2.69)
5-
AC_INIT([cpp-pthread],[1.0.0],[[email protected]],[http://mut-mut-scmv1.dev.parimutuel.local/applications/cpp-pthread])
5+
AC_INIT([cpp-pthread],[m4_esyscmd_s(echo $(git describe --always))],[[email protected]],[])
66
AC_LANG(C++)
77

88
AC_CONFIG_AUX_DIR([/usr/bin . bin])

cpp-pthread.xcodeproj/project.pbxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
E54543411CAD23690051A313 /* mutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5EC5B7B1C9C2C6B00E21131 /* mutex.cpp */; };
1515
E54543421CAD23690051A313 /* lock_guard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E519A0E41C9C4B4F00ED113D /* lock_guard.cpp */; };
1616
E54543431CAD23690051A313 /* thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E519A0FF1C9C7CAB00ED113D /* thread.cpp */; };
17+
E580F99C1CB3174F00A7CE3A /* pthread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E580F99B1CB3174F00A7CE3A /* pthread.cpp */; };
1718
E5BF2B651CB13C8100B158E3 /* without-cpp11-pthread-tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5BF2B631CB13C7700B158E3 /* without-cpp11-pthread-tests.cpp */; };
1819
E5BF2B661CB13C8900B158E3 /* libcpp-pthread.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E5EC5B711C9C2C3000E21131 /* libcpp-pthread.a */; };
1920
E5C4D71D1C9DC8C700D0E18C /* pthread in Headers */ = {isa = PBXBuildFile; fileRef = E5EC5B811C9C2C8B00E21131 /* pthread */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -63,6 +64,7 @@
6364
E519A0E41C9C4B4F00ED113D /* lock_guard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lock_guard.cpp; path = src/lock_guard.cpp; sourceTree = "<group>"; };
6465
E519A0FF1C9C7CAB00ED113D /* thread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = thread.cpp; path = src/thread.cpp; sourceTree = "<group>"; };
6566
E54543351CAD21A30051A313 /* cpp11-pthread-tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp11-pthread-tests"; sourceTree = BUILT_PRODUCTS_DIR; };
67+
E580F99B1CB3174F00A7CE3A /* pthread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pthread.cpp; path = src/pthread.cpp; sourceTree = "<group>"; };
6668
E5BF2B5A1CB13C3D00B158E3 /* without-cpp11-pthread-tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "without-cpp11-pthread-tests"; sourceTree = BUILT_PRODUCTS_DIR; };
6769
E5BF2B631CB13C7700B158E3 /* without-cpp11-pthread-tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "without-cpp11-pthread-tests.cpp"; sourceTree = "<group>"; };
6870
E5EC5B711C9C2C3000E21131 /* libcpp-pthread.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcpp-pthread.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -130,6 +132,7 @@
130132
E5EC5B801C9C2C7100E21131 /* src */ = {
131133
isa = PBXGroup;
132134
children = (
135+
E580F99B1CB3174F00A7CE3A /* pthread.cpp */,
133136
E5EC5B791C9C2C6B00E21131 /* condition_variable.cpp */,
134137
E5EC5B7B1C9C2C6B00E21131 /* mutex.cpp */,
135138
E519A0E41C9C4B4F00ED113D /* lock_guard.cpp */,
@@ -278,6 +281,7 @@
278281
buildActionMask = 2147483647;
279282
files = (
280283
E519A0E51C9C4B4F00ED113D /* lock_guard.cpp in Sources */,
284+
E580F99C1CB3174F00A7CE3A /* pthread.cpp in Sources */,
281285
E5EC5B7D1C9C2C6B00E21131 /* condition_variable.cpp in Sources */,
282286
E5EC5B7F1C9C2C6B00E21131 /* mutex.cpp in Sources */,
283287
E519A1011C9C7CAB00ED113D /* thread.cpp in Sources */,
@@ -464,6 +468,7 @@
464468
E5BF2B601CB13C3D00B158E3 /* Release */,
465469
);
466470
defaultConfigurationIsVisible = 0;
471+
defaultConfigurationName = Release;
467472
};
468473
E5EC5B6C1C9C2C3000E21131 /* Build configuration list for PBXProject "cpp-pthread" */ = {
469474
isa = XCConfigurationList;

include/pthread/pthread.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@
3131
*/
3232
namespace pthread {
3333

34+
extern "C" const char *cpp_pthread_version();
35+
3436
}
3537
#endif /* pthread_pthread_hpp */

include/pthread/thread.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,14 @@ namespace pthread {
223223
public:
224224
virtual ~abstract_thread();
225225

226+
/** start running the `run()` method in a new thread.
227+
*/
226228
void start();
227229

230+
/** joins this thread.
231+
*
232+
* an exception is thrown if deadlock condition are detected.
233+
*/
228234
int join() { return _thread->join() ;};
229235

230236
private:

src/Makefile.in

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,8 @@ libcpp-pthread.a: $(OBJECTS)
4444
${AR} ${LIBDIR}/$@ $(OBJECTS)
4545
$(RANLIB) ${LIBDIR}/$@
4646

47-
dist:
48-
$(MV) $(TARGETS) $(BINDIR)
49-
5047
globber: clean
51-
$(RM) -R Makefile autom4te.cache config.log config.status configure
48+
-$(RM) -R Makefile autom4te.cache config.log config.status
5249

5350
clean:
5451
${RM} *.o core *.a

src/configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# Process this file with autoconf to produce a configure script.
33

44
AC_PREREQ(2.69)
5-
AC_INIT([cpp-pthread],[1.0.0],[herbert.koelman@pmu.fr])
5+
AC_INIT([cpp-pthread],[m4_esyscmd_s(echo $(git describe --always --abbrev=0))],[herbert.koelman@me.com],[],[http://herbertkoelman.github.io/cpp-pthread/])
66
AC_LANG(C++)
77
AC_CONFIG_SRCDIR([thread.cpp])
88
AC_CONFIG_AUX_DIR([/usr/bin ../ ../bin])
99
AC_CONFIG_HEADERS([../include/pthread/config.h])
10-
AC_DEFINE_UNQUOTED(CPP_THREAD_VERSION, ["version: $PACKAGE_VERSION - branch: <branch> - compiled on `uname -sv`."], [pthread C++ wrapper.])
10+
AC_DEFINE_UNQUOTED(CPP_PTHREAD_VERSION, ["$PACKAGE_NAME $PACKAGE_VERSION - $(git log --pretty='%H' | head -1) - compiled on `uname -sv`."], [pthread C++ wrapper.])
1111

1212
# Checks for programs.
13-
AC_PROG_CXX([xlC_r xlC gcc cl KCC CC cxx cc++ aCC c++ g++])
13+
AC_PROG_CXX([xlC_r xlC g++ c++ gcc cl KCC CC cxx cc++ aCC ])
1414
AC_PROG_CC([xlc xlc_r gcc cl cc])
1515
AC_CHECK_PROG([AR],[ar],[ar -rv])
1616
AC_CHECK_PROG([MV],[mv],[mv],[echo "no mv command found"])

src/pthread.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
#include "pthread/pthread.hpp"
1313
#include "pthread/config.h"
1414

15+
1516
namespace pthread {
1617

17-
extern "C" const char *cpp_pthread_version(){
18+
extern "C" const char *cpp_pthread_version(){
1819
#ifndef CPP_PTHREAD_VERSION
19-
return "missing CPP_PTHREAD_VERSION define. Re-run configure" ;
20+
return "missing CPP_PTHREAD_VERSION define. Re-run configure" ;
2021
#else
21-
return CPP_PTHREAD_VERSION ;
22+
return CPP_PTHREAD_VERSION ;
2223
#endif
23-
}
24+
}
25+
2426
}
2527
#endif /* pthread_pthread_hpp */

0 commit comments

Comments
 (0)