Merge branch 'master' of github.com:bytemaster/fc

This commit is contained in:
Daniel Larimer 2013-01-04 12:35:26 -08:00
commit a5a88a50c7
6 changed files with 24 additions and 14 deletions

View file

@ -1,9 +1,14 @@
#ifndef _FC_ERROR_HPP_
#define _FC_ERROR_HPP_
#pragma once
#include <fc/string.hpp>
namespace fc {
struct future_wait_timeout: public std::exception{};
struct future_wait_timeout: public std::exception{
future_wait_timeout( const fc::string& msg = "" ):m_msg(msg){}
~future_wait_timeout()throw() {}
const char* what()const throw() { return m_msg.c_str(); }
private:
fc::string m_msg;
};
struct task_canceled: public std::exception{};
struct thread_quit: public std::exception{};
struct wait_any_error: public std::exception{};
@ -29,4 +34,3 @@ namespace fc {
};
}
#endif // _FC_ERROR_HPP_

View file

@ -65,8 +65,9 @@ namespace fc {
void reserve( size_t );
size_t size()const;
size_t find( char c, size_t pos = 0 )const;
size_t rfind( char c, size_t pos = 0 )const;
size_t rfind( const fc::string& c, size_t pos = 0 )const;
size_t rfind( char c, size_t pos = npos )const;
size_t rfind( const char* c, size_t pos = npos )const;
size_t rfind( const fc::string& c, size_t pos = npos )const;
void resize( size_t s );
void clear();

View file

@ -1,5 +1,4 @@
#ifndef _FC_THREAD_HPP_
#define _FC_THREAD_HPP_
#pragma once
#include <fc/task.hpp>
#include <fc/vector.hpp>
#include <fc/string.hpp>
@ -175,4 +174,3 @@ namespace fc {
}
}
#endif

View file

@ -34,6 +34,7 @@ namespace fc {
size_t string::size()const { return my->size(); }
size_t string::find(char c, size_t p)const { return my->find(c,p); }
size_t string::rfind(char c, size_t p)const { return my->rfind(c,p); }
size_t string::rfind(const char* c, size_t p)const { return my->rfind(c,p); }
size_t string::rfind(const fc::string& c, size_t p)const { return my->rfind(c,p); }
void string::clear() { my->clear(); }
void string::resize( size_t s ) { my->resize(s); }

View file

@ -1,5 +1,6 @@
#include <fc/thread.hpp>
#include <fc/vector.hpp>
#include <fc/sstream.hpp>
#include "thread_d.hpp"
namespace fc {
@ -179,8 +180,13 @@ namespace fc {
if( p[i]->ready() ) return i;
}
if( timeout < time_point::now() )
BOOST_THROW_EXCEPTION( future_wait_timeout() );
if( timeout < time_point::now() ) {
fc::stringstream ss;
for( auto i = p.begin(); i != p.end(); ++i ) {
ss << (*i)->get_desc() <<", ";
}
BOOST_THROW_EXCEPTION( future_wait_timeout( ss.str() ) );
}
if( !my->current ) {
my->current = new fc::context(&fc::thread::current());
@ -264,7 +270,7 @@ namespace fc {
void thread::wait_until( promise_base::ptr&& p, const time_point& timeout ) {
if( p->ready() ) return;
if( timeout < time_point::now() )
BOOST_THROW_EXCEPTION( future_wait_timeout() );
BOOST_THROW_EXCEPTION( future_wait_timeout( p->get_desc() ) );
if( !my->current ) {
my->current = new fc::context(&fc::thread::current());

View file

@ -1,3 +1,3 @@
add_subdirectory( libssh2-1.4.2 )
add_subdirectory( zlib-1.2.7)
#add_subdirectory( sigar )
#add_subdirectory( zlib-1.2.7)
add_subdirectory( sigar )