fix crash in fc::cin
This commit is contained in:
parent
68e50ee166
commit
1bbe3b7c41
3 changed files with 4 additions and 4 deletions
|
|
@ -123,7 +123,7 @@ namespace fc {
|
||||||
bool exists( const path& p ) { return boost::filesystem::exists(p); }
|
bool exists( const path& p ) { return boost::filesystem::exists(p); }
|
||||||
void create_directories( const path& p ) {
|
void create_directories( const path& p ) {
|
||||||
try {
|
try {
|
||||||
boost::filesystem::create_directories(p);
|
boost::filesystem::create_directories(p);
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
FC_THROW_REPORT( "Unable to create directories ${path}", fc::value().set("path", p ).set("inner", fc::except_str() ) );
|
FC_THROW_REPORT( "Unable to create directories ${path}", fc::value().set("path", p ).set("inner", fc::except_str() ) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ namespace fc {
|
||||||
|
|
||||||
struct cin_buffer {
|
struct cin_buffer {
|
||||||
cin_buffer():eof(false),write_pos(0),read_pos(0),cinthread("cin"){
|
cin_buffer():eof(false),write_pos(0),read_pos(0),cinthread("cin"){
|
||||||
|
|
||||||
cinthread.async( [=](){read();} );
|
cinthread.async( [=](){read();} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -131,7 +132,6 @@ namespace fc {
|
||||||
while( !b.eof && (b.write_pos - b.read_pos)==0 ){
|
while( !b.eof && (b.write_pos - b.read_pos)==0 ){
|
||||||
// wait for more...
|
// wait for more...
|
||||||
fc::promise<void>::ptr rr( new fc::promise<void>() );
|
fc::promise<void>::ptr rr( new fc::promise<void>() );
|
||||||
// b.read_ready = rr;
|
|
||||||
{ // copy read_ready because it is accessed from multiple threads
|
{ // copy read_ready because it is accessed from multiple threads
|
||||||
fc::scoped_lock<boost::mutex> lock( b.read_ready_mutex );
|
fc::scoped_lock<boost::mutex> lock( b.read_ready_mutex );
|
||||||
b.read_ready = rr;
|
b.read_ready = rr;
|
||||||
|
|
@ -139,7 +139,7 @@ namespace fc {
|
||||||
if( b.write_pos - b.read_pos == 0 ) {
|
if( b.write_pos - b.read_pos == 0 ) {
|
||||||
rr->wait();
|
rr->wait();
|
||||||
}
|
}
|
||||||
b.read_ready.reset();
|
// b.read_ready.reset();
|
||||||
{ // copy read_ready because it is accessed from multiple threads
|
{ // copy read_ready because it is accessed from multiple threads
|
||||||
fc::scoped_lock<boost::mutex> lock( b.read_ready_mutex );
|
fc::scoped_lock<boost::mutex> lock( b.read_ready_mutex );
|
||||||
b.read_ready.reset();
|
b.read_ready.reset();
|
||||||
|
|
|
||||||
2
vendor/CMakeLists.txt
vendored
2
vendor/CMakeLists.txt
vendored
|
|
@ -1,3 +1,3 @@
|
||||||
add_subdirectory( libssh2-1.4.2 )
|
add_subdirectory( libssh2-1.4.2 )
|
||||||
#add_subdirectory( zlib-1.2.7)
|
#add_subdirectory( zlib-1.2.7)
|
||||||
#add_subdirectory( sigar )
|
add_subdirectory( sigar )
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue