mirror of https://github.com/grpc/grpc.git
commit
1c55919ece
22 changed files with 1203 additions and 198 deletions
@ -0,0 +1,181 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#include <grpc++/impl/sync.h> |
||||
#include <grpc++/impl/thd.h> |
||||
#include <grpc/support/log.h> |
||||
#include <climits> |
||||
|
||||
#include "src/cpp/thread_manager/thread_manager.h" |
||||
|
||||
namespace grpc { |
||||
|
||||
ThreadManager::WorkerThread::WorkerThread(ThreadManager* thd_mgr) |
||||
: thd_mgr_(thd_mgr), thd_(&ThreadManager::WorkerThread::Run, this) {} |
||||
|
||||
void ThreadManager::WorkerThread::Run() { |
||||
thd_mgr_->MainWorkLoop(); |
||||
thd_mgr_->MarkAsCompleted(this); |
||||
} |
||||
|
||||
ThreadManager::WorkerThread::~WorkerThread() { thd_.join(); } |
||||
|
||||
ThreadManager::ThreadManager(int min_pollers, int max_pollers) |
||||
: shutdown_(false), |
||||
num_pollers_(0), |
||||
min_pollers_(min_pollers), |
||||
max_pollers_(max_pollers == -1 ? INT_MAX : max_pollers), |
||||
num_threads_(0) {} |
||||
|
||||
ThreadManager::~ThreadManager() { |
||||
{ |
||||
std::unique_lock<grpc::mutex> lock(mu_); |
||||
GPR_ASSERT(num_threads_ == 0); |
||||
} |
||||
|
||||
CleanupCompletedThreads(); |
||||
} |
||||
|
||||
void ThreadManager::Wait() { |
||||
std::unique_lock<grpc::mutex> lock(mu_); |
||||
while (num_threads_ != 0) { |
||||
shutdown_cv_.wait(lock); |
||||
} |
||||
} |
||||
|
||||
void ThreadManager::Shutdown() { |
||||
std::unique_lock<grpc::mutex> lock(mu_); |
||||
shutdown_ = true; |
||||
} |
||||
|
||||
bool ThreadManager::IsShutdown() { |
||||
std::unique_lock<grpc::mutex> lock(mu_); |
||||
return shutdown_; |
||||
} |
||||
|
||||
void ThreadManager::MarkAsCompleted(WorkerThread* thd) { |
||||
{ |
||||
std::unique_lock<grpc::mutex> list_lock(list_mu_); |
||||
completed_threads_.push_back(thd); |
||||
} |
||||
|
||||
grpc::unique_lock<grpc::mutex> lock(mu_); |
||||
num_threads_--; |
||||
if (num_threads_ == 0) { |
||||
shutdown_cv_.notify_one(); |
||||
} |
||||
} |
||||
|
||||
void ThreadManager::CleanupCompletedThreads() { |
||||
std::unique_lock<grpc::mutex> lock(list_mu_); |
||||
for (auto thd = completed_threads_.begin(); thd != completed_threads_.end(); |
||||
thd = completed_threads_.erase(thd)) { |
||||
delete *thd; |
||||
} |
||||
} |
||||
|
||||
void ThreadManager::Initialize() { |
||||
for (int i = 0; i < min_pollers_; i++) { |
||||
MaybeCreatePoller(); |
||||
} |
||||
} |
||||
|
||||
// If the number of pollers (i.e threads currently blocked in PollForWork()) is
|
||||
// less than max threshold (i.e max_pollers_) and the total number of threads is
|
||||
// below the maximum threshold, we can let the current thread continue as poller
|
||||
bool ThreadManager::MaybeContinueAsPoller() { |
||||
std::unique_lock<grpc::mutex> lock(mu_); |
||||
if (shutdown_ || num_pollers_ > max_pollers_) { |
||||
return false; |
||||
} |
||||
|
||||
num_pollers_++; |
||||
return true; |
||||
} |
||||
|
||||
// Create a new poller if the current number of pollers i.e num_pollers_ (i.e
|
||||
// threads currently blocked in PollForWork()) is below the threshold (i.e
|
||||
// min_pollers_) and the total number of threads is below the maximum threshold
|
||||
void ThreadManager::MaybeCreatePoller() { |
||||
grpc::unique_lock<grpc::mutex> lock(mu_); |
||||
if (!shutdown_ && num_pollers_ < min_pollers_) { |
||||
num_pollers_++; |
||||
num_threads_++; |
||||
|
||||
// Create a new thread (which ends up calling the MainWorkLoop() function
|
||||
new WorkerThread(this); |
||||
} |
||||
} |
||||
|
||||
void ThreadManager::MainWorkLoop() { |
||||
void* tag; |
||||
bool ok; |
||||
|
||||
/*
|
||||
1. Poll for work (i.e PollForWork()) |
||||
2. After returning from PollForWork, reduce the number of pollers by 1. If |
||||
PollForWork() returned a TIMEOUT, then it may indicate that we have more |
||||
polling threads than needed. Check if the number of pollers is greater |
||||
than min_pollers and if so, terminate the thread. |
||||
3. Since we are short of one poller now, see if a new poller has to be |
||||
created (i.e see MaybeCreatePoller() for more details) |
||||
4. Do the actual work (DoWork()) |
||||
5. After doing the work, see it this thread can resume polling work (i.e |
||||
see MaybeContinueAsPoller() for more details) */ |
||||
do { |
||||
WorkStatus work_status = PollForWork(&tag, &ok); |
||||
|
||||
{ |
||||
grpc::unique_lock<grpc::mutex> lock(mu_); |
||||
num_pollers_--; |
||||
|
||||
if (work_status == TIMEOUT && num_pollers_ > min_pollers_) { |
||||
break; |
||||
} |
||||
} |
||||
|
||||
// Note that MaybeCreatePoller does check for shutdown and creates a new
|
||||
// thread only if ThreadManager is not shutdown
|
||||
if (work_status == WORK_FOUND) { |
||||
MaybeCreatePoller(); |
||||
DoWork(tag, ok); |
||||
} |
||||
} while (MaybeContinueAsPoller()); |
||||
|
||||
CleanupCompletedThreads(); |
||||
|
||||
// If we are here, either ThreadManager is shutting down or it already has
|
||||
// enough threads.
|
||||
} |
||||
|
||||
} // namespace grpc
|
@ -0,0 +1,159 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPC_INTERNAL_CPP_THREAD_MANAGER_H |
||||
#define GRPC_INTERNAL_CPP_THREAD_MANAGER_H |
||||
|
||||
#include <list> |
||||
#include <memory> |
||||
|
||||
#include <grpc++/impl/sync.h> |
||||
#include <grpc++/impl/thd.h> |
||||
#include <grpc++/support/config.h> |
||||
|
||||
namespace grpc { |
||||
|
||||
class ThreadManager { |
||||
public: |
||||
explicit ThreadManager(int min_pollers, int max_pollers); |
||||
virtual ~ThreadManager(); |
||||
|
||||
// Initializes and Starts the Rpc Manager threads
|
||||
void Initialize(); |
||||
|
||||
// The return type of PollForWork() function
|
||||
enum WorkStatus { WORK_FOUND, SHUTDOWN, TIMEOUT }; |
||||
|
||||
// "Polls" for new work.
|
||||
// If the return value is WORK_FOUND:
|
||||
// - The implementaion of PollForWork() MAY set some opaque identifier to
|
||||
// (identify the work item found) via the '*tag' parameter
|
||||
// - The implementaion MUST set the value of 'ok' to 'true' or 'false'. A
|
||||
// value of 'false' indicates some implemenation specific error (that is
|
||||
// neither SHUTDOWN nor TIMEOUT)
|
||||
// - ThreadManager does not interpret the values of 'tag' and 'ok'
|
||||
// - ThreadManager WILL call DoWork() and pass '*tag' and 'ok' as input to
|
||||
// DoWork()
|
||||
//
|
||||
// If the return value is SHUTDOWN:,
|
||||
// - ThreadManager WILL NOT call DoWork() and terminates the thead
|
||||
//
|
||||
// If the return value is TIMEOUT:,
|
||||
// - ThreadManager WILL NOT call DoWork()
|
||||
// - ThreadManager MAY terminate the thread depending on the current number
|
||||
// of active poller threads and mix_pollers/max_pollers settings
|
||||
// - Also, the value of timeout is specific to the derived class
|
||||
// implementation
|
||||
virtual WorkStatus PollForWork(void** tag, bool* ok) = 0; |
||||
|
||||
// The implementation of DoWork() is supposed to perform the work found by
|
||||
// PollForWork(). The tag and ok parameters are the same as returned by
|
||||
// PollForWork()
|
||||
//
|
||||
// The implementation of DoWork() should also do any setup needed to ensure
|
||||
// that the next call to PollForWork() (not necessarily by the current thread)
|
||||
// actually finds some work
|
||||
virtual void DoWork(void* tag, bool ok) = 0; |
||||
|
||||
// Mark the ThreadManager as shutdown and begin draining the work. This is a
|
||||
// non-blocking call and the caller should call Wait(), a blocking call which
|
||||
// returns only once the shutdown is complete
|
||||
void Shutdown(); |
||||
|
||||
// Has Shutdown() been called
|
||||
bool IsShutdown(); |
||||
|
||||
// A blocking call that returns only after the ThreadManager has shutdown and
|
||||
// all the threads have drained all the outstanding work
|
||||
void Wait(); |
||||
|
||||
private: |
||||
// Helper wrapper class around std::thread. This takes a ThreadManager object
|
||||
// and starts a new std::thread to calls the Run() function.
|
||||
//
|
||||
// The Run() function calls ThreadManager::MainWorkLoop() function and once
|
||||
// that completes, it marks the WorkerThread completed by calling
|
||||
// ThreadManager::MarkAsCompleted()
|
||||
class WorkerThread { |
||||
public: |
||||
WorkerThread(ThreadManager* thd_mgr); |
||||
~WorkerThread(); |
||||
|
||||
private: |
||||
// Calls thd_mgr_->MainWorkLoop() and once that completes, calls
|
||||
// thd_mgr_>MarkAsCompleted(this) to mark the thread as completed
|
||||
void Run(); |
||||
|
||||
ThreadManager* thd_mgr_; |
||||
grpc::thread thd_; |
||||
}; |
||||
|
||||
// The main funtion in ThreadManager
|
||||
void MainWorkLoop(); |
||||
|
||||
// Create a new poller if the number of current pollers is less than the
|
||||
// minimum number of pollers needed (i.e min_pollers).
|
||||
void MaybeCreatePoller(); |
||||
|
||||
// Returns true if the current thread can resume as a poller. i.e if the
|
||||
// current number of pollers is less than the max_pollers.
|
||||
bool MaybeContinueAsPoller(); |
||||
|
||||
void MarkAsCompleted(WorkerThread* thd); |
||||
void CleanupCompletedThreads(); |
||||
|
||||
// Protects shutdown_, num_pollers_ and num_threads_
|
||||
// TODO: sreek - Change num_pollers and num_threads_ to atomics
|
||||
grpc::mutex mu_; |
||||
|
||||
bool shutdown_; |
||||
grpc::condition_variable shutdown_cv_; |
||||
|
||||
// Number of threads doing polling
|
||||
int num_pollers_; |
||||
|
||||
// The minimum and maximum number of threads that should be doing polling
|
||||
int min_pollers_; |
||||
int max_pollers_; |
||||
|
||||
// The total number of threads (includes threads includes the threads that are
|
||||
// currently polling i.e num_pollers_)
|
||||
int num_threads_; |
||||
|
||||
grpc::mutex list_mu_; |
||||
std::list<WorkerThread*> completed_threads_; |
||||
}; |
||||
|
||||
} // namespace grpc
|
||||
|
||||
#endif // GRPC_INTERNAL_CPP_THREAD_MANAGER_H
|
@ -0,0 +1,136 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
*is % allowed in string |
||||
*/ |
||||
|
||||
#include <memory> |
||||
#include <string> |
||||
|
||||
#include <gflags/gflags.h> |
||||
#include <grpc++/grpc++.h> |
||||
#include <grpc/support/log.h> |
||||
#include <grpc/support/port_platform.h> |
||||
|
||||
#include "src/cpp/thread_manager/thread_manager.h" |
||||
#include "test/cpp/util/test_config.h" |
||||
|
||||
namespace grpc { |
||||
class ThreadManagerTest GRPC_FINAL : public grpc::ThreadManager { |
||||
public: |
||||
ThreadManagerTest() |
||||
: ThreadManager(kMinPollers, kMaxPollers), |
||||
num_do_work_(0), |
||||
num_poll_for_work_(0), |
||||
num_work_found_(0) {} |
||||
|
||||
grpc::ThreadManager::WorkStatus PollForWork(void **tag, |
||||
bool *ok) GRPC_OVERRIDE; |
||||
void DoWork(void *tag, bool ok) GRPC_OVERRIDE; |
||||
void PerformTest(); |
||||
|
||||
private: |
||||
void SleepForMs(int sleep_time_ms); |
||||
|
||||
static const int kMinPollers = 2; |
||||
static const int kMaxPollers = 10; |
||||
|
||||
static const int kPollingTimeoutMsec = 10; |
||||
static const int kDoWorkDurationMsec = 1; |
||||
|
||||
// PollForWork will return SHUTDOWN after these many number of invocations
|
||||
static const int kMaxNumPollForWork = 50; |
||||
|
||||
gpr_atm num_do_work_; // Number of calls to DoWork
|
||||
gpr_atm num_poll_for_work_; // Number of calls to PollForWork
|
||||
gpr_atm num_work_found_; // Number of times WORK_FOUND was returned
|
||||
}; |
||||
|
||||
void ThreadManagerTest::SleepForMs(int duration_ms) { |
||||
gpr_timespec sleep_time = |
||||
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
||||
gpr_time_from_millis(duration_ms, GPR_TIMESPAN)); |
||||
gpr_sleep_until(sleep_time); |
||||
} |
||||
|
||||
grpc::ThreadManager::WorkStatus ThreadManagerTest::PollForWork(void **tag, |
||||
bool *ok) { |
||||
int call_num = gpr_atm_no_barrier_fetch_add(&num_poll_for_work_, 1); |
||||
|
||||
if (call_num >= kMaxNumPollForWork) { |
||||
Shutdown(); |
||||
return SHUTDOWN; |
||||
} |
||||
|
||||
// Simulate "polling for work" by sleeping for sometime
|
||||
SleepForMs(kPollingTimeoutMsec); |
||||
|
||||
*tag = nullptr; |
||||
*ok = true; |
||||
|
||||
// Return timeout roughly 1 out of every 3 calls
|
||||
if (call_num % 3 == 0) { |
||||
return TIMEOUT; |
||||
} else { |
||||
gpr_atm_no_barrier_fetch_add(&num_work_found_, 1); |
||||
return WORK_FOUND; |
||||
} |
||||
} |
||||
|
||||
void ThreadManagerTest::DoWork(void *tag, bool ok) { |
||||
gpr_atm_no_barrier_fetch_add(&num_do_work_, 1); |
||||
SleepForMs(kDoWorkDurationMsec); // Simulate doing work by sleeping
|
||||
} |
||||
|
||||
void ThreadManagerTest::PerformTest() { |
||||
// Initialize() starts the ThreadManager
|
||||
Initialize(); |
||||
|
||||
// Wait for all the threads to gracefully terminate
|
||||
Wait(); |
||||
|
||||
// The number of times DoWork() was called is equal to the number of times
|
||||
// WORK_FOUND was returned
|
||||
gpr_log(GPR_DEBUG, "DoWork() called %ld times", |
||||
gpr_atm_no_barrier_load(&num_do_work_)); |
||||
GPR_ASSERT(gpr_atm_no_barrier_load(&num_do_work_) == |
||||
gpr_atm_no_barrier_load(&num_work_found_)); |
||||
} |
||||
} // namespace grpc
|
||||
|
||||
int main(int argc, char **argv) { |
||||
std::srand(std::time(NULL)); |
||||
|
||||
grpc::testing::InitTest(&argc, &argv, true); |
||||
grpc::ThreadManagerTest test_rpc_manager; |
||||
test_rpc_manager.PerformTest(); |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,201 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\1.0.204.1.props')" /> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Debug|Win32"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Debug|x64"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|Win32"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|x64"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{08C611E4-7F87-73BE-76CE-C158A4CC05A3}</ProjectGuid> |
||||
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> |
||||
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration"> |
||||
<PlatformToolset>v100</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration"> |
||||
<PlatformToolset>v110</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration"> |
||||
<PlatformToolset>v120</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'" Label="Configuration"> |
||||
<PlatformToolset>v140</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\cpptest.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\global.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\openssl.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\protobuf.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\winsock.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\zlib.props" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> |
||||
<TargetName>thread_manager_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'"> |
||||
<TargetName>thread_manager_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Release</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\test\cpp\thread_manager\thread_manager_test.cc"> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++\grpc++.vcxproj"> |
||||
<Project>{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj"> |
||||
<Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj"> |
||||
<Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_test_config\grpc++_test_config.vcxproj"> |
||||
<Project>{3F7D093D-11F9-C4BC-BEB7-18EB28E3F290}</Project> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="packages.config" /> |
||||
</ItemGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
</ImportGroup> |
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
||||
<PropertyGroup> |
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |
||||
</PropertyGroup> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" /> |
||||
</Target> |
||||
</Project> |
||||
|
@ -0,0 +1,21 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\test\cpp\thread_manager\thread_manager_test.cc"> |
||||
<Filter>test\cpp\thread_manager</Filter> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<Filter Include="test"> |
||||
<UniqueIdentifier>{e9e471cd-7f7e-9abc-af13-ec58851849ac}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\cpp"> |
||||
<UniqueIdentifier>{b350f72c-af76-7272-4342-1b0fc7a458ee}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\cpp\thread_manager"> |
||||
<UniqueIdentifier>{6b09ea8d-fbc6-e6fe-f884-b3d3dfcbfc12}</UniqueIdentifier> |
||||
</Filter> |
||||
</ItemGroup> |
||||
</Project> |
||||
|
Loading…
Reference in new issue