-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
langmead
committed
May 8, 2009
1 parent
a983891
commit cb0599f
Showing
4 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* log.cpp | ||
*/ | ||
|
||
#include "log.h" | ||
|
||
SyncLogger glog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef LOG_H_ | ||
#define LOG_H_ | ||
|
||
#include <iostream> | ||
#include "threading.h" | ||
|
||
class SyncLogger { | ||
public: | ||
SyncLogger() { | ||
MUTEX_INIT(lock_); | ||
} | ||
|
||
void msg(const char *s) { | ||
MUTEX_LOCK(lock_); | ||
std::cout << s << std::endl; | ||
MUTEX_UNLOCK(lock_); | ||
} | ||
|
||
void msg(const std::string& s) { | ||
MUTEX_LOCK(lock_); | ||
std::cout << s << std::endl; | ||
MUTEX_UNLOCK(lock_); | ||
} | ||
|
||
private: | ||
MUTEX_T lock_; | ||
}; | ||
|
||
extern SyncLogger glog; | ||
|
||
#endif /*LOG_H_*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters