Commit 76664c60 authored by gejun's avatar gejun

Patch svn r35091

parent 6a2aafc8
...@@ -353,7 +353,7 @@ void TaskControl::signal_task(int num_task) { ...@@ -353,7 +353,7 @@ void TaskControl::signal_task(int num_task) {
if (num_task > 2) { if (num_task > 2) {
num_task = 2; num_task = 2;
} }
int start_index = base::fmix32(pthread_self()) % PARKING_LOT_NUM; int start_index = base::fmix64(pthread_self()) % PARKING_LOT_NUM;
num_task -= _pl[start_index].signal(1); num_task -= _pl[start_index].signal(1);
if (num_task > 0) { if (num_task > 0) {
for (int i = 1; i < PARKING_LOT_NUM && num_task > 0; ++i) { for (int i = 1; i < PARKING_LOT_NUM && num_task > 0; ++i) {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "base/scoped_lock.h" // BAIDU_SCOPED_LOCK #include "base/scoped_lock.h" // BAIDU_SCOPED_LOCK
#include "base/fast_rand.h" #include "base/fast_rand.h"
#include "base/unique_ptr.h" #include "base/unique_ptr.h"
#include "base/third_party/murmurhash3/murmurhash3.h" // fmix32 #include "base/third_party/murmurhash3/murmurhash3.h" // fmix64
#include "bthread/errno.h" // ESTOP #include "bthread/errno.h" // ESTOP
#include "bthread/butex.h" // butex_* #include "bthread/butex.h" // butex_*
#include "bthread/sys_futex.h" // futex_wake_private #include "bthread/sys_futex.h" // futex_wake_private
...@@ -207,7 +207,7 @@ TaskGroup::TaskGroup(TaskControl* c) ...@@ -207,7 +207,7 @@ TaskGroup::TaskGroup(TaskControl* c)
{ {
_steal_seed = base::fast_rand(); _steal_seed = base::fast_rand();
_steal_offset = OFFSET_TABLE[_steal_seed % ARRAY_SIZE(OFFSET_TABLE)]; _steal_offset = OFFSET_TABLE[_steal_seed % ARRAY_SIZE(OFFSET_TABLE)];
_pl = &c->_pl[base::fmix32(pthread_self()) % TaskControl::PARKING_LOT_NUM]; _pl = &c->_pl[base::fmix64(pthread_self()) % TaskControl::PARKING_LOT_NUM];
CHECK(c); CHECK(c);
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <queue> // heap functions #include <queue> // heap functions
#include "base/scoped_lock.h" #include "base/scoped_lock.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/third_party/murmurhash3/murmurhash3.h" // fmix32 #include "base/third_party/murmurhash3/murmurhash3.h" // fmix64
#include "base/resource_pool.h" #include "base/resource_pool.h"
#include "bvar/bvar.h" #include "bvar/bvar.h"
#include "bthread/sys_futex.h" #include "bthread/sys_futex.h"
...@@ -207,7 +207,7 @@ TimerThread::TaskId TimerThread::schedule( ...@@ -207,7 +207,7 @@ TimerThread::TaskId TimerThread::schedule(
} }
// Hashing by pthread id is better for cache locality. // Hashing by pthread id is better for cache locality.
const Bucket::ScheduleResult result = const Bucket::ScheduleResult result =
_buckets[base::fmix32(pthread_self()) % _options.num_buckets] _buckets[base::fmix64(pthread_self()) % _options.num_buckets]
.schedule(fn, arg, abstime); .schedule(fn, arg, abstime);
if (result.earlier) { if (result.earlier) {
bool earlier = false; bool earlier = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment