fix shared ptr bugs

This commit is contained in:
Daniel Larimer 2012-09-14 00:05:08 -04:00
parent d82dc3a782
commit 766f44e629
3 changed files with 3 additions and 8 deletions

View file

@ -36,8 +36,8 @@ namespace fc {
friend bool operator==( const endpoint& a, const endpoint& b );
private:
uint16_t _port;
address _ip;
uint16_t _port;
};
}
}

View file

@ -41,11 +41,11 @@ namespace fc {
}
~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( _ptr ) _ptr->release();
_ptr = v;
if( _ptr ) _ptr->retain();
if( _ptr && inc ) _ptr->retain();
return *this;
}

View file

@ -17,11 +17,6 @@ namespace fc {
cin_source( const cin_source& s ):_cin_thread(s._cin_thread){}
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);
if( std::cin && r <= 0 ) {
std::cin.read( s, 1 );