Skip to content

Commit

Permalink
Merge pull request #629 from muflihun/develop
Browse files Browse the repository at this point in the history
closes #580 conditional global lock
  • Loading branch information
abumq authored Apr 3, 2018
2 parents dd84272 + 094e4ab commit 8092189
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [9.96.4] - 03-04-2018
### Fixes
- Fixes seg fault with global lock (issue #580)

## [9.96.3] - 01-04-2018
### Fixes
- Demangling in GCC fixed
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ option(lib_utc_datetime "Build library with UTC date/time logging" OFF)

set(ELPP_MAJOR_VERSION "9")
set(ELPP_MINOR_VERSION "96")
set(ELPP_PATCH_VERSION "3")
set(ELPP_PATCH_VERSION "4")
set(ELPP_VERSION_STRING "${ELPP_MAJOR_VERSION}.${ELPP_MINOR_VERSION}.${ELPP_PATCH_VERSION}")

set(ELPP_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ Some of logging options can be set by macros, this is a thoughtful decision, for
| `ELPP_NO_CHECK_MACROS` | Do not define the *CHECK* macros |
| `ELPP_NO_DEBUG_MACROS` | Do not define the *DEBUG* macros |
| `ELPP_UTC_DATETIME` | Uses UTC time instead of local time (essentially uses `gmtime` instead of `localtime` and family functions)
| `ELPP_NO_GLOBAL_LOCK` | Do not lock the whole storage on dispatch. This should be used with care. See [issue #580](https://github.com/muflihun/easyloggingpp/issues/580)|

[![top] Goto Top](#table-of-contents)

Expand Down
1 change: 1 addition & 0 deletions samples/STL/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ macro="$macro -DELPP_LOG_UNORDERED_MAP"
macro="$macro -DELPP_FEATURE_CRASH_LOG"
macro="$macro -DELPP_LOGGING_FLAGS_FROM_ARG"
macro="$macro -DELPP_FEATURE_ALL"
macro="$macro -DELPP_NO_GLOBAL_LOCK"
# macro="$macro -DELPP_DEFAULT_LOG_FILE=\"/a/path/that/does/not/exist/f.log\""

if [ "$2" = "" ];then
Expand Down
6 changes: 6 additions & 0 deletions src/easylogging++.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,12 @@ void LogDispatcher::dispatch(void) {
if (!m_proceed) {
return;
}
#ifndef ELPP_NO_GLOBAL_LOCK
// see https://github.com/muflihun/easyloggingpp/issues/580
// global lock is turned off by default unless
// ELPP_NO_GLOBAL_LOCK is defined
base::threading::ScopedLock scopedLock(ELPP->lock());
#endif
base::TypedConfigurations* tc = m_logMessage->logger()->m_typedConfigurations;
if (ELPP->hasFlag(LoggingFlag::StrictLogFileSizeCheck)) {
tc->validateFileRolling(m_logMessage->level(), ELPP->preRollOutCallback());
Expand Down
2 changes: 1 addition & 1 deletion src/easylogging++.h
Original file line number Diff line number Diff line change
Expand Up @@ -2538,7 +2538,7 @@ class IWorker {
};
#endif // ELPP_ASYNC_LOGGING
/// @brief Easylogging++ management storage
class Storage : base::NoCopy {
class Storage : base::NoCopy, public base::threading::ThreadSafe {
public:
#if ELPP_ASYNC_LOGGING
Storage(const LogBuilderPtr& defaultLogBuilder, base::IWorker* asyncDispatchWorker);
Expand Down

0 comments on commit 8092189

Please sign in to comment.