Add macOS support #34
	
		
			
	
		
	
	
		
	
		
			Some checks are pending
		
		
	
	
		
			
				
	
				BlockStorage/repertory/pipeline/head Build queued...
				
			
		
		
	
	
				
					
				
			
		
			Some checks are pending
		
		
	
	BlockStorage/repertory/pipeline/head Build queued...
				
			This commit is contained in:
		| @@ -22,7 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_COMMON_HPP_ | ||||
| #define REPERTORY_INCLUDE_COMMON_HPP_ | ||||
|  | ||||
| #if defined(__GNUC__) | ||||
| #if defined(__GNUC__) && !defined(PROJECT_IS_DARWIN) | ||||
| // clang-format off | ||||
| #define REPERTORY_IGNORE_WARNINGS_ENABLE()                                     \ | ||||
|   _Pragma("GCC diagnostic push")                                               \ | ||||
|   | ||||
| @@ -98,7 +98,7 @@ private: | ||||
|   std::condition_variable notify_; | ||||
|   std::mutex start_stop_mutex_; | ||||
|   stop_type stop_requested_{false}; | ||||
|   std::vector<std::unique_ptr<std::jthread>> task_threads_; | ||||
|   std::vector<std::unique_ptr<std::thread>> task_threads_; | ||||
|   std::deque<scheduled_task> tasks_; | ||||
|  | ||||
| private: | ||||
|   | ||||
| @@ -86,8 +86,9 @@ void tasks::start(app_config *config) { | ||||
|  | ||||
|   for (std::uint32_t idx = 0U; idx < std::thread::hardware_concurrency() * 2U; | ||||
|        ++idx) { | ||||
|     task_threads_.emplace_back( | ||||
|         std::make_unique<std::jthread>([this]() { task_thread(); })); | ||||
|     auto thread{std::make_unique<std::thread>([this]() { task_thread(); })}; | ||||
|     thread->detach(); | ||||
|     task_threads_.emplace_back(std::move(thread)); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -100,7 +101,7 @@ void tasks::stop() { | ||||
|   stop_requested_ = true; | ||||
|  | ||||
|   unique_mutex_lock lock(mutex_); | ||||
|   std::vector<std::unique_ptr<std::jthread>> threads; | ||||
|   std::vector<std::unique_ptr<std::thread>> threads; | ||||
|   std::swap(threads, task_threads_); | ||||
|  | ||||
|   std::deque<scheduled_task> task_list; | ||||
|   | ||||
| @@ -118,10 +118,10 @@ auto to_api_error(int err) -> api_error { | ||||
| #if defined(__APPLE__) | ||||
|   case EBADMSG: | ||||
|     return api_error::download_failed; | ||||
| #else | ||||
| #else  // !defined(__APPLE__) | ||||
|   case EREMOTEIO: | ||||
|     return api_error::download_failed; | ||||
| #endif | ||||
| #endif // defined(__APPLE__) | ||||
|   case EIO: | ||||
|     return api_error::error; | ||||
|   case EEXIST: | ||||
| @@ -130,8 +130,6 @@ auto to_api_error(int err) -> api_error { | ||||
|     return api_error::file_in_use; | ||||
|   case EINVAL: | ||||
|     return api_error::invalid_operation; | ||||
|   case ENAMETOOLONG: | ||||
|     return api_error::name_too_long; | ||||
|   case ENOENT: | ||||
|     return api_error::item_not_found; | ||||
|   case ENOMEM: | ||||
| @@ -151,17 +149,19 @@ auto to_api_error(int err) -> api_error { | ||||
| #if defined(__APPLE__) | ||||
|   case ENOATTR: | ||||
|     return api_error::xattr_not_found; | ||||
| #else | ||||
| #else  // !defined(__APPLE__) | ||||
|   case ENODATA: | ||||
|     return api_error::xattr_not_found; | ||||
| #endif | ||||
| #endif // defined(__APPLE__) | ||||
| #if defined(__APPLE__) | ||||
|   case ENAMETOOLONG: | ||||
|     return api_error::xattr_too_big; | ||||
| #else | ||||
| #else  // !defined(__APPLE__) | ||||
|   case ENAMETOOLONG: | ||||
|     return api_error::name_too_long; | ||||
|   case E2BIG: | ||||
|     return api_error::xattr_too_big; | ||||
| #endif | ||||
| #endif // defined(__APPLE__) | ||||
|   default: | ||||
|     return api_error::error; | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user