via with priority
authorJames Sedgwick <jsedgwick@fb.com>
Thu, 14 May 2015 00:45:10 +0000 (17:45 -0700)
committerViswanath Sivakumar <viswanath@fb.com>
Wed, 20 May 2015 17:57:06 +0000 (10:57 -0700)
commitc8250894a847994e9f76960564a6a56d68b85f5c
treec87f846c3ae9156e4ea4902bff714e8840ffd89b
parent1185881df4c4a6195f5cd99dae703a0ff0a1ec58
via with priority

Summary:
I wish I could just have an add(Func, priority) but the damned overloaded virtual warnings become a nightmare, so it's addWithPriority.
I also switched priority to a uint8_t in the hopes of reducing Core size. Turns out std::atomic<uint8_t> is 8 bytes anyways :( I left it that way because come on you really shouldn't be using > 256 priorities.
Biggest problem is the data race with the two atomics executor_ and priority_. Should we just use a microspinlock to co-protect them? Could probably save some size from the atomics that way.

Test Plan: unit

Reviewed By: hans@fb.com

Subscribers: hannesr, fugalh, folly-diffs@, jsedgwick, yfeldblum, chalfant

FB internal diff: D2039619

Tasks: 6928162

Signature: t1:2039619:1431551266:3b31ed2329301aaa9c32f0f41b6e61f3482d570e
folly/Executor.h
folly/futures/Future-inl.h
folly/futures/Future.h
folly/futures/detail/Core.h
folly/futures/helpers.h
folly/futures/test/ViaTest.cpp
folly/wangle/concurrent/BlockingQueue.h
folly/wangle/concurrent/CPUThreadPoolExecutor.cpp
folly/wangle/concurrent/CPUThreadPoolExecutor.h
folly/wangle/concurrent/PriorityLifoSemMPMCQueue.h
folly/wangle/concurrent/test/ThreadPoolExecutorTest.cpp