* Network selector * Make sure network option is checked before working path is called (migration). Also remove bool assignment from error. * Formatting * Fix merge error * Use network_params for RPC port config (rebase) * Formatting * Rebase * Rebase (debug_opencl, merge fix) * Rebase fix * post-rebase update
52 lines
1.6 KiB
C++
52 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <boost/optional.hpp>
|
|
#include <boost/thread/thread.hpp>
|
|
#include <nano/lib/config.hpp>
|
|
#include <nano/lib/numbers.hpp>
|
|
#include <nano/lib/utility.hpp>
|
|
|
|
#include <atomic>
|
|
#include <condition_variable>
|
|
#include <memory>
|
|
#include <thread>
|
|
|
|
namespace nano
|
|
{
|
|
class block;
|
|
bool work_validate (nano::block_hash const &, uint64_t, uint64_t * = nullptr);
|
|
bool work_validate (nano::block const &, uint64_t * = nullptr);
|
|
uint64_t work_value (nano::block_hash const &, uint64_t);
|
|
class opencl_work;
|
|
class work_item
|
|
{
|
|
public:
|
|
nano::uint256_union item;
|
|
std::function<void(boost::optional<uint64_t> const &)> callback;
|
|
uint64_t difficulty;
|
|
};
|
|
class work_pool
|
|
{
|
|
public:
|
|
work_pool (unsigned, std::function<boost::optional<uint64_t> (nano::uint256_union const &, uint64_t)> = nullptr);
|
|
~work_pool ();
|
|
void loop (uint64_t);
|
|
void stop ();
|
|
void cancel (nano::uint256_union const &);
|
|
void generate (nano::uint256_union const &, std::function<void(boost::optional<uint64_t> const &)>);
|
|
void generate (nano::uint256_union const &, std::function<void(boost::optional<uint64_t> const &)>, uint64_t);
|
|
uint64_t generate (nano::uint256_union const &);
|
|
uint64_t generate (nano::uint256_union const &, uint64_t);
|
|
nano::network_params network_params;
|
|
std::atomic<int> ticket;
|
|
bool done;
|
|
std::vector<boost::thread> threads;
|
|
std::list<nano::work_item> pending;
|
|
std::mutex mutex;
|
|
std::condition_variable producer_condition;
|
|
std::function<boost::optional<uint64_t> (nano::uint256_union const &, uint64_t)> opencl;
|
|
nano::observer_set<bool> work_observers;
|
|
};
|
|
|
|
std::unique_ptr<seq_con_info_component> collect_seq_con_info (work_pool & work_pool, const std::string & name);
|
|
}
|