Skip to content

Commit 0b88511

Browse files
authored
Merge pull request #285 from evoskuil/master
Regenerate artifacts.
2 parents fa9a2d3 + 5c09542 commit 0b88511

File tree

9 files changed

+41
-30
lines changed

9 files changed

+41
-30
lines changed

include/bitcoin/protocol/config/authority.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* You should have received a copy of the GNU Affero General Public License
1717
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
*/
19-
2019
#ifndef LIBBITCOIN_PROTOCOL_CONFIG_AUTHORITY_HPP
2120
#define LIBBITCOIN_PROTOCOL_CONFIG_AUTHORITY_HPP
2221

include/bitcoin/protocol/config/sodium.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class BCP_API sodium
3737
/// A list of base85 values.
3838
/// This must provide operator<< for ostream in order to be used as a
3939
/// boost::program_options default_value.
40-
typedef std::vector<sodium> list;
41-
4240
sodium() NOEXCEPT;
4341
sodium(const std::string& base85) THROWS;
4442
sodium(const system::hash_digest& value) NOEXCEPT;
@@ -61,6 +59,8 @@ class BCP_API sodium
6159
system::hash_digest value_;
6260
};
6361

62+
typedef std::vector<sodium> sodiums;
63+
6464
} // namespace protocol
6565
} // namespace libbitcoin
6666

include/bitcoin/protocol/define.hpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@
3737
#define BCP_INTERNAL BC_HELPER_DLL_LOCAL
3838
#endif
3939

40-
// Log name.
41-
////#define LOG_PROTOCOL "protocol"
42-
////#define LOG_PROTOCOL_HTTP "http"
43-
////
44-
////// TODO: generalize logging.
45-
////#define LOG_INFO(name) std::cout << name << " : "
46-
////#define LOG_DEBUG(name) std::cout << name << " : "
47-
////#define LOG_VERBOSE(name) std::cout << name << " : "
48-
////#define LOG_ERROR(name) std::cerr << name << " : "
49-
////#define LOG_WARNING(name) std::cerr << name << " : "
50-
5140
#endif
5241

5342
// context ->

include/bitcoin/protocol/network.hpp

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,29 @@
2424
// config::authority and config::endpoint are also cloned from network.
2525

2626
#include <memory>
27+
#include <thread>
2728
#include <bitcoin/system.hpp>
2829

2930
#ifdef HAVE_MSC
3031
#include <windows.h>
32+
// #define THREAD_PRIORITY_IDLE -15
33+
// #define THREAD_PRIORITY_LOWEST -2
34+
// #define THREAD_PRIORITY_BELOW_NORMAL -1
35+
// #define THREAD_PRIORITY_NORMAL 0
36+
// #define THREAD_PRIORITY_ABOVE_NORMAL 1
37+
// #define THREAD_PRIORITY_HIGHEST 2
38+
// #define THREAD_PRIORITY_TIME_CRITICAL 15
39+
// #define THREAD_PRIORITY_ERROR_RETURN (MAXLONG)
3140
#else
3241
#include <unistd.h>
3342
#include <pthread.h>
3443
#include <sys/resource.h>
3544
#include <sys/types.h>
36-
#ifndef PRIO_MAX
37-
#define PRIO_MAX 20
38-
#endif
39-
#define THREAD_PRIORITY_ABOVE_NORMAL (-2)
40-
#define THREAD_PRIORITY_NORMAL 0
41-
#define THREAD_PRIORITY_BELOW_NORMAL 2
42-
#define THREAD_PRIORITY_LOWEST PRIO_MAX
45+
#define THREAD_PRIORITY_HIGHEST -20
46+
#define THREAD_PRIORITY_ABOVE_NORMAL -2
47+
#define THREAD_PRIORITY_NORMAL 0
48+
#define THREAD_PRIORITY_BELOW_NORMAL 2
49+
#define THREAD_PRIORITY_LOWEST 20
4350
#endif
4451

4552
namespace libbitcoin {
@@ -62,6 +69,7 @@ class enable_shared_from_base
6269

6370
enum class thread_priority
6471
{
72+
highest,
6573
high,
6674
normal,
6775
low,
@@ -79,26 +87,43 @@ inline int get_priority(thread_priority priority) NOEXCEPT
7987
return THREAD_PRIORITY_BELOW_NORMAL;
8088
case thread_priority::high:
8189
return THREAD_PRIORITY_ABOVE_NORMAL;
90+
case thread_priority::highest:
91+
return THREAD_PRIORITY_HIGHEST;
8292
default:
8393
case thread_priority::normal:
8494
return THREAD_PRIORITY_NORMAL;
8595
}
8696
}
8797

88-
// Set the thread priority (or process if thread priority is not available).
98+
// Set the thread priority.
99+
// TODO: handle error conditions.
100+
// TODO: handle potential lack of PRIO_THREAD
101+
// TODO: use proper non-win32 priority levels.
102+
// TODO: Linux: pthread_setschedprio()
103+
// TOOD: macOS: somethign else.
89104
inline void set_priority(thread_priority priority) NOEXCEPT
90105
{
91106
const auto prioritization = get_priority(priority);
92107

93-
BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
94108
#if defined(HAVE_MSC)
109+
// learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/
110+
// nf-processthreadsapi-getthreadpriority
95111
SetThreadPriority(GetCurrentThread(), prioritization);
112+
96113
#elif defined(PRIO_THREAD)
114+
// lore.kernel.org/lkml/[email protected]/
97115
setpriority(PRIO_THREAD, pthread_self(), prioritization);
116+
98117
#else
118+
// BUGBUG: This will set all threads in the process.
119+
// man7.org/linux/man-pages/man3/pthread_self.3.html
99120
setpriority(PRIO_PROCESS, getpid(), prioritization);
100121
#endif
101-
BC_POP_WARNING()
122+
}
123+
124+
inline size_t cores() NOEXCEPT
125+
{
126+
return std::max(std::thread::hardware_concurrency(), 1_u32);
102127
}
103128

104129
} // namespace protocol

install-cmake.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ build_from_tarball_boost()
906906
"$BOOST_CXXFLAGS" \
907907
"$BOOST_LINKFLAGS" \
908908
"link=$BOOST_LINK" \
909-
"warnings=off" \
909+
"warnings=off" \
910910
"boost.locale.iconv=$BOOST_ICU_ICONV" \
911911
"boost.locale.posix=$BOOST_ICU_POSIX" \
912912
"-sNO_BZIP2=1" \

install-cmakepresets.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ build_from_tarball_boost()
945945
"$BOOST_CXXFLAGS" \
946946
"$BOOST_LINKFLAGS" \
947947
"link=$BOOST_LINK" \
948-
"warnings=off" \
948+
"warnings=off" \
949949
"boost.locale.iconv=$BOOST_ICU_ICONV" \
950950
"boost.locale.posix=$BOOST_ICU_POSIX" \
951951
"-sNO_BZIP2=1" \

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ build_from_tarball_boost()
781781
"$BOOST_CXXFLAGS" \
782782
"$BOOST_LINKFLAGS" \
783783
"link=$BOOST_LINK" \
784-
"warnings=off" \
784+
"warnings=off" \
785785
"boost.locale.iconv=$BOOST_ICU_ICONV" \
786786
"boost.locale.posix=$BOOST_ICU_POSIX" \
787787
"-sNO_BZIP2=1" \

src/zmq/authenticator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ authenticator::~authenticator() NOEXCEPT
5151
stop();
5252
}
5353

54-
authenticator::operator context& () NOEXCEPT
54+
authenticator::operator context&() NOEXCEPT
5555
{
5656
return context_;
5757
}

src/zmq/worker.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ namespace zmq {
3333

3434
using namespace bc::system;
3535

36-
#define NAME "worker"
37-
3836
// Derive from this abstract worker to implement concrete worker.
3937
worker::worker(thread_priority priority) NOEXCEPT
4038
: priority_(priority),

0 commit comments

Comments
 (0)