* Added autoconf support for cacheline_aligned and SMP_CACHE_BYTES.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1115 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2009-12-18 21:56:14 +00:00
parent 2304983f4f
commit 5470e50ffb
8 changed files with 38 additions and 19 deletions
+2 -3
View File
@@ -40,6 +40,7 @@
#include <stdexcept>
#include <unistd.h>
#include <sys/time.h>
#include <rak/allocators.h>
#include <torrent/exceptions.h>
#include <torrent/poll_select.h>
#include <torrent/torrent.h>
@@ -53,9 +54,7 @@ PollManagerSelect::PollManagerSelect(torrent::Poll* p) : PollManager(p) {
#if defined USE_VARIABLE_FDSET
m_setSize = (m_poll->open_max() + 7) / 8;
char* buffer;
posix_memalign((void**)&buffer, L1_CACHE_BYTES, 3 * m_setSize);
char* buffer = rak::cacheline_allocator<char>::alloc_size(3 * m_setSize);
std::memset(buffer, 0, 3 * m_setSize);
m_readSet = (fd_set*)buffer;
+1 -1
View File
@@ -45,7 +45,7 @@ namespace torrent {
namespace core {
class __cacheline_aligned PollManagerSelect : public PollManager {
class lt_cacheline_aligned PollManagerSelect : public PollManager {
public:
static PollManagerSelect* create(int maxOpenSockets);
~PollManagerSelect();
+2 -2
View File
@@ -47,9 +47,9 @@
// Temporarly injected into config.h.
/* temp hack */
//#define __cacheline_aligned __attribute__((__aligned__(128)))
//#define lt_cacheline_aligned __attribute__((__aligned__(128)))
class __cacheline_aligned thread_queue_hack {
class lt_cacheline_aligned thread_queue_hack {
public:
typedef ThreadBase::thread_base_func value_type;
typedef ThreadBase::thread_base_func* iterator;
+1 -1
View File
@@ -42,7 +42,7 @@
// Check if cacheline aligned with inheritance ends up taking two
// cachelines.
class __cacheline_aligned ThreadMain : public ThreadBase {
class lt_cacheline_aligned ThreadMain : public ThreadBase {
public:
ThreadMain() {}
~ThreadMain();
+1 -1
View File
@@ -44,7 +44,7 @@
// Check if cacheline aligned with inheritance ends up taking two
// cachelines.
class __cacheline_aligned ThreadWorker : public ThreadBase {
class lt_cacheline_aligned ThreadWorker : public ThreadBase {
public:
ThreadWorker();
~ThreadWorker();