revert lock types, enable logging, disable sanitezers

This commit is contained in:
Pavel Baykov 2022-04-04 03:03:56 -03:00
parent 434c91b9cb
commit 0dbcb052b2
4 changed files with 21 additions and 22 deletions

View file

@ -16,6 +16,9 @@ INCLUDE( VersionMacros )
INCLUDE( SetupTargetMacros )
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_unix_timestamp(FC_GIT_REVISION_UNIX_TIMESTAMP)

View file

@ -71,7 +71,7 @@ namespace fc {
virtual void cancel(const char* reason FC_CANCELATION_REASON_DEFAULT_ARG);
bool canceled()const { return _canceled; }
bool ready()const;
bool error();
bool error()const;
void set_exception( const fc::exception_ptr& e );
@ -87,9 +87,7 @@ namespace fc {
void _on_complete( detail::completion_handler* c );
~promise_base();
friend class thread;
friend class thread_d;
fwd<spin_lock,8> _spinlock;
//fwd<spin_lock,8> _spinlock;
private:
friend class thread;
@ -97,7 +95,7 @@ namespace fc {
friend class thread_d;
bool _ready;
//mutable spin_yield_lock _spin_yield;
mutable spin_yield_lock _spin_yield;
thread* _blocked_thread;
unsigned _blocked_fiber_count;
time_point _timeout;

View file

@ -62,7 +62,6 @@ namespace fc {
}
void logger::log( log_message m ) {
/*
m.get_context().append_context( my->_name );
for( auto itr = my->_appenders.begin(); itr != my->_appenders.end(); ++itr )
@ -71,7 +70,6 @@ namespace fc {
if( my->_additivity && my->_parent != nullptr) {
my->_parent.log(m);
}
*/
}
void logger::set_name( const fc::string& n ) { my->_name = n; }
const fc::string& logger::name()const { return my->_name; }

View file

@ -31,8 +31,8 @@ namespace fc {
}
void promise_base::cancel(const char* reason /* = nullptr */){
//synchronized(_spin_yield)
synchronized( *_spinlock )
synchronized(_spin_yield)
//synchronized( *_spinlock )
// wlog("${desc} canceled!", ("desc", _desc? _desc : ""));
_canceled = true;
#ifndef NDEBUG
@ -42,9 +42,9 @@ namespace fc {
bool promise_base::ready()const {
return _ready;
}
bool promise_base::error() {
{ //synchronized(_spin_yield)
synchronized( *_spinlock )
bool promise_base::error()const {
{ synchronized(_spin_yield)
//synchronized( *_spinlock )
return _exceptp != nullptr;
}
}
@ -61,8 +61,8 @@ namespace fc {
_wait_until( time_point::now() + timeout_us );
}
void promise_base::_wait_until( const time_point& timeout_us ){
{ //synchronized(_spin_yield)
synchronized( *_spinlock )
{ synchronized(_spin_yield)
//synchronized( *_spinlock )
if( _ready ) {
if( _exceptp )
_exceptp->dynamic_rethrow_exception();
@ -118,8 +118,8 @@ namespace fc {
_blocked_thread = &thread::current();
}
void promise_base::_dequeue_thread(){
//synchronized(_spin_yield)
synchronized( *_spinlock )
synchronized(_spin_yield)
//synchronized( *_spinlock )
if (!--_blocked_fiber_count)
_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
// calling notify on a null pointer
thread* blocked_thread;
{ //synchronized(_spin_yield)
synchronized( *_spinlock )
{ synchronized(_spin_yield)
//synchronized( *_spinlock )
blocked_thread = _blocked_thread;
}
if( blocked_thread )
@ -157,8 +157,8 @@ namespace fc {
if (_ready){
return;
}
{ //synchronized(_spin_yield)
synchronized( *_spinlock )
{ synchronized(_spin_yield)
//synchronized( *_spinlock )
if (_ready) //don't allow promise to be set more than once
return;
_ready = true;
@ -169,8 +169,8 @@ namespace fc {
}
}
void promise_base::_on_complete( detail::completion_handler* c ) {
{ //synchronized(_spin_yield)
synchronized( *_spinlock )
{ synchronized(_spin_yield)
//synchronized( *_spinlock )
delete _compl;
_compl = c;
}