Skip to content

Commit

Permalink
Fixed Linux (GCC 6) build
Browse files Browse the repository at this point in the history
  • Loading branch information
grantila committed Jan 8, 2017
1 parent 74c9d15 commit fb87e45
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 18 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ else ( )
add_definitions( "-Wall" )
add_definitions( "-Wno-comment" )

# set( GENERIC_LIB_DEPS pthread dl )
if ( NOT APPLE )
set( GENERIC_LIB_DEPS pthread dl )
endif ( )
endif ( )

include_directories( "libs/q/include" )
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if [ "a$BUILDTYPE" == "a" ]; then
fi

if [ "$BUILDTYPE" == "Unix Makefiles" ]; then
mkdir -p obj
cd obj
mkdir -p build
cd build

# Create 4 different makefiles (each in a separate directory)
mkdir release; cd release ; cmake -G "$BUILDTYPE" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ../.. ; cd ..
Expand Down
2 changes: 2 additions & 0 deletions libs/q/include/q/backlog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <q/types.hpp>
#include <q/type_traits.hpp>

#include <limits>

namespace q {

class backlog
Expand Down
2 changes: 2 additions & 0 deletions libs/q/include/q/concurrency.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <q/types.hpp>
#include <q/type_traits.hpp>

#include <limits>

namespace q {

class concurrency
Expand Down
16 changes: 8 additions & 8 deletions libs/q/include/q/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,38 @@ struct timer_task
timer_task( const timer_task& ) = delete;

timer_task( task&& _task )
: task( std::move( _task ) )
: task_( std::move( _task ) )
, is_timed_( false )
{ }

timer_task( task&& _task, timer::point_type&& _wait_until )
: task( std::move( _task ) )
, wait_until( std::move( _wait_until ) )
: task_( std::move( _task ) )
, wait_until_( std::move( _wait_until ) )
, is_timed_( true )
{ }

bool operator!( ) const
{
return !this->task;
return !this->task_;
}

operator bool( ) const
{
return !!this->task;
return !!this->task_;
}

bool operator<( const timer_task& other ) const
{
return wait_until < other.wait_until;
return wait_until_ < other.wait_until_;
}

bool is_timed( ) const
{
return is_timed_;
}

task task;
timer::point_type wait_until;
task task_;
timer::point_type wait_until_;

private:
bool is_timed_;
Expand Down
6 changes: 3 additions & 3 deletions libs/q/src/blocking_dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,16 @@ void blocking_dispatcher::start( )
// We just add the timed task and re-iterate.
// This handling needs a complete overhaul. TODO
pimpl_->timer_tasks_.push(
std::move( _task.wait_until ),
std::move( _task.task ) );
std::move( _task.wait_until_ ),
std::move( _task.task_ ) );

continue;
}
else if ( _task )
{
Q_AUTO_UNIQUE_UNLOCK( lock );

_task.task( );
_task.task_( );
}

if ( pimpl_->running_ && !_task )
Expand Down
5 changes: 4 additions & 1 deletion libs/q/src/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ void set_thread_name( const std::string& name )
#elif defined( LIBQ_ON_BSD )
pthread_set_name_np( tid, name.c_str( ) );
#else
pthread_setname_np( tid, name.c_str( ) );
if ( name.size( ) > 15 )
pthread_setname_np( tid, name.substr( 0, 15 ).c_str( ) );
else
pthread_setname_np( tid, name.c_str( ) );
#endif

#elif defined( LIBQ_ON_WINDOWS )
Expand Down
6 changes: 3 additions & 3 deletions libs/q/src/threadpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,16 @@ promise< > threadpool::start( )
// highly inefficient and needs to be
// entirely redesigned. TODO
pimpl_->timer_tasks_.push(
std::move( _task.wait_until ),
std::move( _task.task ) );
std::move( _task.wait_until_ ),
std::move( _task.task_ ) );

continue;
}
else if ( _task )
{
Q_AUTO_UNIQUE_UNLOCK( lock );

invoker( std::move( _task.task ) );
invoker( std::move( _task.task_ ) );
}

if ( pimpl_->running_ && !_task )
Expand Down

0 comments on commit fb87e45

Please sign in to comment.