revert lock types, enable logging, disable sanitezers
This commit is contained in:
parent
434c91b9cb
commit
0dbcb052b2
4 changed files with 21 additions and 22 deletions
|
|
@ -16,6 +16,9 @@ INCLUDE( VersionMacros )
|
||||||
INCLUDE( SetupTargetMacros )
|
INCLUDE( SetupTargetMacros )
|
||||||
INCLUDE(GetGitRevisionDescription)
|
INCLUDE(GetGitRevisionDescription)
|
||||||
|
|
||||||
|
#add_compile_options(-fsanitize=address -fsanitize-recover=address)
|
||||||
|
#add_link_options(-fsanitize=address -fsanitize-recover=address -static-libasan)
|
||||||
|
|
||||||
get_git_head_revision(GIT_REFSPEC FC_GIT_REVISION_SHA)
|
get_git_head_revision(GIT_REFSPEC FC_GIT_REVISION_SHA)
|
||||||
get_git_unix_timestamp(FC_GIT_REVISION_UNIX_TIMESTAMP)
|
get_git_unix_timestamp(FC_GIT_REVISION_UNIX_TIMESTAMP)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ namespace fc {
|
||||||
virtual void cancel(const char* reason FC_CANCELATION_REASON_DEFAULT_ARG);
|
virtual void cancel(const char* reason FC_CANCELATION_REASON_DEFAULT_ARG);
|
||||||
bool canceled()const { return _canceled; }
|
bool canceled()const { return _canceled; }
|
||||||
bool ready()const;
|
bool ready()const;
|
||||||
bool error();
|
bool error()const;
|
||||||
|
|
||||||
void set_exception( const fc::exception_ptr& e );
|
void set_exception( const fc::exception_ptr& e );
|
||||||
|
|
||||||
|
|
@ -87,9 +87,7 @@ namespace fc {
|
||||||
void _on_complete( detail::completion_handler* c );
|
void _on_complete( detail::completion_handler* c );
|
||||||
~promise_base();
|
~promise_base();
|
||||||
|
|
||||||
friend class thread;
|
//fwd<spin_lock,8> _spinlock;
|
||||||
friend class thread_d;
|
|
||||||
fwd<spin_lock,8> _spinlock;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class thread;
|
friend class thread;
|
||||||
|
|
@ -97,7 +95,7 @@ namespace fc {
|
||||||
friend class thread_d;
|
friend class thread_d;
|
||||||
|
|
||||||
bool _ready;
|
bool _ready;
|
||||||
//mutable spin_yield_lock _spin_yield;
|
mutable spin_yield_lock _spin_yield;
|
||||||
thread* _blocked_thread;
|
thread* _blocked_thread;
|
||||||
unsigned _blocked_fiber_count;
|
unsigned _blocked_fiber_count;
|
||||||
time_point _timeout;
|
time_point _timeout;
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@ namespace fc {
|
||||||
}
|
}
|
||||||
|
|
||||||
void logger::log( log_message m ) {
|
void logger::log( log_message m ) {
|
||||||
/*
|
|
||||||
m.get_context().append_context( my->_name );
|
m.get_context().append_context( my->_name );
|
||||||
|
|
||||||
for( auto itr = my->_appenders.begin(); itr != my->_appenders.end(); ++itr )
|
for( auto itr = my->_appenders.begin(); itr != my->_appenders.end(); ++itr )
|
||||||
|
|
@ -71,7 +70,6 @@ namespace fc {
|
||||||
if( my->_additivity && my->_parent != nullptr) {
|
if( my->_additivity && my->_parent != nullptr) {
|
||||||
my->_parent.log(m);
|
my->_parent.log(m);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
void logger::set_name( const fc::string& n ) { my->_name = n; }
|
void logger::set_name( const fc::string& n ) { my->_name = n; }
|
||||||
const fc::string& logger::name()const { return my->_name; }
|
const fc::string& logger::name()const { return my->_name; }
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ namespace fc {
|
||||||
}
|
}
|
||||||
|
|
||||||
void promise_base::cancel(const char* reason /* = nullptr */){
|
void promise_base::cancel(const char* reason /* = nullptr */){
|
||||||
//synchronized(_spin_yield)
|
synchronized(_spin_yield)
|
||||||
synchronized( *_spinlock )
|
//synchronized( *_spinlock )
|
||||||
// wlog("${desc} canceled!", ("desc", _desc? _desc : ""));
|
// wlog("${desc} canceled!", ("desc", _desc? _desc : ""));
|
||||||
_canceled = true;
|
_canceled = true;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
|
@ -42,9 +42,9 @@ namespace fc {
|
||||||
bool promise_base::ready()const {
|
bool promise_base::ready()const {
|
||||||
return _ready;
|
return _ready;
|
||||||
}
|
}
|
||||||
bool promise_base::error() {
|
bool promise_base::error()const {
|
||||||
{ //synchronized(_spin_yield)
|
{ synchronized(_spin_yield)
|
||||||
synchronized( *_spinlock )
|
//synchronized( *_spinlock )
|
||||||
return _exceptp != nullptr;
|
return _exceptp != nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -61,8 +61,8 @@ namespace fc {
|
||||||
_wait_until( time_point::now() + timeout_us );
|
_wait_until( time_point::now() + timeout_us );
|
||||||
}
|
}
|
||||||
void promise_base::_wait_until( const time_point& timeout_us ){
|
void promise_base::_wait_until( const time_point& timeout_us ){
|
||||||
{ //synchronized(_spin_yield)
|
{ synchronized(_spin_yield)
|
||||||
synchronized( *_spinlock )
|
//synchronized( *_spinlock )
|
||||||
if( _ready ) {
|
if( _ready ) {
|
||||||
if( _exceptp )
|
if( _exceptp )
|
||||||
_exceptp->dynamic_rethrow_exception();
|
_exceptp->dynamic_rethrow_exception();
|
||||||
|
|
@ -118,8 +118,8 @@ namespace fc {
|
||||||
_blocked_thread = &thread::current();
|
_blocked_thread = &thread::current();
|
||||||
}
|
}
|
||||||
void promise_base::_dequeue_thread(){
|
void promise_base::_dequeue_thread(){
|
||||||
//synchronized(_spin_yield)
|
synchronized(_spin_yield)
|
||||||
synchronized( *_spinlock )
|
//synchronized( *_spinlock )
|
||||||
if (!--_blocked_fiber_count)
|
if (!--_blocked_fiber_count)
|
||||||
_blocked_thread = nullptr;
|
_blocked_thread = nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -128,8 +128,8 @@ namespace fc {
|
||||||
// because of a timeout) before we get a chance to notify it, we won't be
|
// because of a timeout) before we get a chance to notify it, we won't be
|
||||||
// calling notify on a null pointer
|
// calling notify on a null pointer
|
||||||
thread* blocked_thread;
|
thread* blocked_thread;
|
||||||
{ //synchronized(_spin_yield)
|
{ synchronized(_spin_yield)
|
||||||
synchronized( *_spinlock )
|
//synchronized( *_spinlock )
|
||||||
blocked_thread = _blocked_thread;
|
blocked_thread = _blocked_thread;
|
||||||
}
|
}
|
||||||
if( blocked_thread )
|
if( blocked_thread )
|
||||||
|
|
@ -157,8 +157,8 @@ namespace fc {
|
||||||
if (_ready){
|
if (_ready){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
{ //synchronized(_spin_yield)
|
{ synchronized(_spin_yield)
|
||||||
synchronized( *_spinlock )
|
//synchronized( *_spinlock )
|
||||||
if (_ready) //don't allow promise to be set more than once
|
if (_ready) //don't allow promise to be set more than once
|
||||||
return;
|
return;
|
||||||
_ready = true;
|
_ready = true;
|
||||||
|
|
@ -169,8 +169,8 @@ namespace fc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void promise_base::_on_complete( detail::completion_handler* c ) {
|
void promise_base::_on_complete( detail::completion_handler* c ) {
|
||||||
{ //synchronized(_spin_yield)
|
{ synchronized(_spin_yield)
|
||||||
synchronized( *_spinlock )
|
//synchronized( *_spinlock )
|
||||||
delete _compl;
|
delete _compl;
|
||||||
_compl = c;
|
_compl = c;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue