fix shared ptr bugs
This commit is contained in:
parent
d82dc3a782
commit
766f44e629
3 changed files with 3 additions and 8 deletions
|
|
@ -36,8 +36,8 @@ namespace fc {
|
||||||
friend bool operator==( const endpoint& a, const endpoint& b );
|
friend bool operator==( const endpoint& a, const endpoint& b );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t _port;
|
|
||||||
address _ip;
|
address _ip;
|
||||||
|
uint16_t _port;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,11 @@ namespace fc {
|
||||||
}
|
}
|
||||||
~shared_ptr() { if( _ptr ) { _ptr->release(); } }
|
~shared_ptr() { if( _ptr ) { _ptr->release(); } }
|
||||||
|
|
||||||
shared_ptr& reset( T* v = 0 ) {
|
shared_ptr& reset( T* v = 0, bool inc = false ) {
|
||||||
if( v == _ptr ) return *this;
|
if( v == _ptr ) return *this;
|
||||||
if( _ptr ) _ptr->release();
|
if( _ptr ) _ptr->release();
|
||||||
_ptr = v;
|
_ptr = v;
|
||||||
if( _ptr ) _ptr->retain();
|
if( _ptr && inc ) _ptr->retain();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,6 @@ namespace fc {
|
||||||
cin_source( const cin_source& s ):_cin_thread(s._cin_thread){}
|
cin_source( const cin_source& s ):_cin_thread(s._cin_thread){}
|
||||||
|
|
||||||
std::streamsize read( char* s, std::streamsize n ) {
|
std::streamsize read( char* s, std::streamsize n ) {
|
||||||
//if( !_cin_thread ) _cin_thread = new fc::thread("cin");
|
|
||||||
|
|
||||||
//if( _cin_thread != &fc::thread::current() ) {
|
|
||||||
// return _cin_thread->async( [=](){ return this->read( s, n ); } ).wait();
|
|
||||||
// }
|
|
||||||
int r = std::cin.readsome(s,n);
|
int r = std::cin.readsome(s,n);
|
||||||
if( std::cin && r <= 0 ) {
|
if( std::cin && r <= 0 ) {
|
||||||
std::cin.read( s, 1 );
|
std::cin.read( s, 1 );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue