mirror of
https://github.com/monero-project/monero.git
synced 2025-11-28 16:30:27 -05:00
Merge pull request #3226
e4646379keccak: fix mdlen bounds sanity checking (moneromooo-monero)2e3e90acpass large parameters by const ref, not value (moneromooo-monero)61defd89blockchain: sanity check number of precomputed hash of hash blocks (moneromooo-monero)9af6b2d1ringct: fix infinite loop in unused h2b function (moneromooo-monero)8cea8d0csimplewallet: double check a new multisig wallet is multisig (moneromooo-monero)9b98a6acthreadpool: catch exceptions in dtor, to avoid terminate (moneromooo-monero)24803ed9blockchain_export: fix buffer overflow in exporter (moneromooo-monero)f3f7da62perf_timer: rewrite to make it clear there is no division by zero (moneromooo-monero)c6ea3df0performance_tests: remove add_arg call stray extra param (moneromooo-monero)fa6b4566fuzz_tests: fix an uninitialized var in setup (moneromooo-monero)03887f11keccak: fix sanity check bounds test (moneromooo-monero)ad11db91blockchain_db: initialize m_open in base class ctor (moneromooo-monero)bece67f9miner: restore std::cout precision after modification (moneromooo-monero)1aabd14cdb_lmdb: check hard fork info drop succeeded (moneromooo-monero)
This commit is contained in:
commit
f4a6bc79d9
21 changed files with 72 additions and 33 deletions
|
|
@ -49,16 +49,15 @@ namespace
|
|||
#ifdef __x86_64__
|
||||
uint64_t get_ticks_per_ns()
|
||||
{
|
||||
uint64_t t0 = epee::misc_utils::get_ns_count();
|
||||
uint64_t t0 = epee::misc_utils::get_ns_count(), t1;
|
||||
uint64_t r0 = get_tick_count();
|
||||
|
||||
while (1)
|
||||
{
|
||||
uint64_t t = epee::misc_utils::get_ns_count();
|
||||
if (t - t0 > 1*1000000000) break; // work one second
|
||||
t1 = epee::misc_utils::get_ns_count();
|
||||
if (t1 - t0 > 1*1000000000) break; // work one second
|
||||
}
|
||||
|
||||
uint64_t t1 = epee::misc_utils::get_ns_count();
|
||||
uint64_t r1 = get_tick_count();
|
||||
uint64_t tpns256 = 256 * (r1 - r0) / (t1 - t0);
|
||||
return tpns256 ? tpns256 : 1;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "misc_log_ex.h"
|
||||
#include "common/threadpool.h"
|
||||
|
||||
#include <cassert>
|
||||
|
|
@ -81,6 +82,23 @@ int threadpool::get_max_concurrency() {
|
|||
return max;
|
||||
}
|
||||
|
||||
threadpool::waiter::~waiter()
|
||||
{
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lock(mt);
|
||||
if (num)
|
||||
MERROR("wait should have been called before waiter dtor - waiting now");
|
||||
}
|
||||
try
|
||||
{
|
||||
wait();
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
/* ignored */
|
||||
}
|
||||
}
|
||||
|
||||
void threadpool::waiter::wait() {
|
||||
boost::unique_lock<boost::mutex> lock(mt);
|
||||
while(num) cv.wait(lock);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include <functional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace tools
|
||||
{
|
||||
|
|
@ -57,7 +58,7 @@ public:
|
|||
void dec();
|
||||
void wait(); //! Wait for a set of tasks to finish.
|
||||
waiter() : num(0){}
|
||||
~waiter() { wait(); }
|
||||
~waiter();
|
||||
};
|
||||
|
||||
// Submit a task to the pool. The waiter pointer may be
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue