16 #include <boost/bind.hpp>
17 #include <gtest/gtest.h>
32 DCHECK(consumer != NULL);
55 EXPECT_EQ(counter1.
counter(), 0);
60 EXPECT_EQ(counter1.
counter(), 1);
61 bool is_reserved =
false;
64 EXPECT_TRUE(is_reserved);
66 EXPECT_FALSE(is_reserved);
68 EXPECT_FALSE(is_reserved);
70 EXPECT_FALSE(is_reserved);
76 EXPECT_EQ(counter1.
counter(), 3);
90 EXPECT_EQ(counter1.
counter(), 3);
91 EXPECT_EQ(counter2.
counter(), 1);
96 int main(
int argc,
char **argv) {
97 ::testing::InitGoogleTest(&argc, argv);
99 return RUN_ALL_TESTS();
bool TryAcquireThreadToken(bool *is_reserved=NULL)
int num_required_threads() const
Returns the number of threads that are from AcquireThreadToken.
int64_t num_threads() const
void SetThreadAvailableCb(ThreadAvailableCb fn)
ResourcePool * RegisterPool()
void ReserveOptionalTokens(int num)
void ReleaseThreadToken(bool required)
void UnregisterPool(ResourcePool *pool)
int num_optional_threads() const
void Notify(ThreadResourceMgr::ResourcePool *consumer)
int main(int argc, char **argv)
static void Init()
Initialize CpuInfo.
void AcquireThreadToken()