@@ -5,8 +5,9 @@
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#ifdef __clang__
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-register"
|
||||
#ifndef __clang__
|
||||
#else
|
||||
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#endif
|
||||
|
||||
@@ -101,7 +101,7 @@ struct PlacementProperty {
|
||||
: zoom(zoom), rotationRange(rotationRange) {}
|
||||
|
||||
inline operator bool() const {
|
||||
return !isnan(zoom) && zoom != std::numeric_limits<float>::infinity() &&
|
||||
return !std::isnan(zoom) && zoom != std::numeric_limits<float>::infinity() &&
|
||||
rotationRange[0] != rotationRange[1];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#ifndef MBGL_UTIL_THREADPOOL
|
||||
#define MBGL_UTIL_THREADPOOL
|
||||
|
||||
#include <pthread.h>
|
||||
#include <forward_list>
|
||||
#include <queue>
|
||||
|
||||
namespace mbgl {
|
||||
namespace util {
|
||||
|
||||
class Threadpool {
|
||||
private:
|
||||
class Worker {
|
||||
public:
|
||||
Worker(Threadpool& pool);
|
||||
~Worker();
|
||||
static void *loop(void *ptr);
|
||||
|
||||
private:
|
||||
Threadpool& pool;
|
||||
pthread_t thread;
|
||||
};
|
||||
|
||||
public:
|
||||
Threadpool(int max_workers = 4);
|
||||
typedef void (*Callback)(void *);
|
||||
void add(Callback callback, void *data);
|
||||
|
||||
private:
|
||||
typedef std::pair<Callback, void *> Task;
|
||||
const int max_workers;
|
||||
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_cond_t condition = PTHREAD_COND_INITIALIZER;
|
||||
std::forward_list<Worker> workers;
|
||||
int worker_count = 0;
|
||||
std::queue<Task> tasks;
|
||||
};
|
||||
|
||||
extern std::unique_ptr<Threadpool> threadpool;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
#include <memory>
|
||||
|
||||
// g++/libstdc++ is missing c++11 codecvt support
|
||||
#ifdef __linux__
|
||||
#if ! defined(__clang__) || defined(__linux__)
|
||||
#pragma GCC diagnostic push
|
||||
#ifndef __clang__
|
||||
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
|
||||
#endif
|
||||
#include <boost/locale.hpp>
|
||||
#pragma GCC diagnostic pop
|
||||
#else
|
||||
// Assume that codecvt is present on clang on non-linux systems
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#endif
|
||||
@@ -20,7 +19,7 @@ namespace mbgl {
|
||||
|
||||
namespace util {
|
||||
|
||||
#ifdef __linux__
|
||||
#if ! defined(__clang__) || defined(__linux__)
|
||||
|
||||
class utf8_to_utf32 {
|
||||
public:
|
||||
|
||||
@@ -71,7 +71,7 @@ struct vec2 {
|
||||
|
||||
template<typename U = T, typename std::enable_if<std::numeric_limits<U>::has_quiet_NaN, int>::type = 0>
|
||||
inline operator bool() const {
|
||||
return !isnan(x) && !isnan(y);
|
||||
return !std::isnan(x) && !std::isnan(y);
|
||||
}
|
||||
|
||||
template<typename U = T, typename std::enable_if<!std::numeric_limits<U>::has_quiet_NaN, int>::type = 0>
|
||||
|
||||
Reference in New Issue
Block a user