|
|
|||
File indexing completed on 2026-04-17 08:35:04
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one 0003 * or more contributor license agreements. See the NOTICE file 0004 * distributed with this work for additional information 0005 * regarding copyright ownership. The ASF licenses this file 0006 * to you under the Apache License, Version 2.0 (the 0007 * "License"); you may not use this file except in compliance 0008 * with the License. You may obtain a copy of the License at 0009 * 0010 * http://www.apache.org/licenses/LICENSE-2.0 0011 * 0012 * Unless required by applicable law or agreed to in writing, 0013 * software distributed under the License is distributed on an 0014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 0015 * KIND, either express or implied. See the License for the 0016 * specific language governing permissions and limitations 0017 * under the License. 0018 */ 0019 0020 #ifndef _THRIFT_TRANSPORT_WINDOWS_TWINSOCKSINGLETON_H_ 0021 #define _THRIFT_TRANSPORT_WINDOWS_TWINSOCKSINGLETON_H_ 1 0022 0023 #if defined(_MSC_VER) && (_MSC_VER > 1200) 0024 #pragma once 0025 #endif // _MSC_VER 0026 0027 #ifndef _WIN32 0028 #error This is a MSVC header only. 0029 #endif 0030 0031 #include <thrift/thrift-config.h> 0032 0033 // boost 0034 #include <thrift/TNonCopyable.h> 0035 0036 #include <memory> 0037 #include <mutex> 0038 0039 0040 namespace apache { 0041 namespace thrift { 0042 namespace transport { 0043 0044 /** 0045 * Winsock2 must be intialised once only in order to create sockets. This class 0046 * performs a one time initialisation when create is called. 0047 */ 0048 class TWinsockSingleton : private apache::thrift::TNonCopyable { 0049 0050 public: 0051 typedef std::shared_ptr<TWinsockSingleton> instance_ptr; 0052 0053 private: 0054 TWinsockSingleton(void); 0055 0056 public: 0057 virtual ~TWinsockSingleton(void); 0058 0059 public: 0060 static void create(void); 0061 0062 private: 0063 static void init(void); 0064 0065 private: 0066 static instance_ptr instance_ptr_; 0067 static std::once_flag flags_; 0068 }; 0069 } 0070 } 0071 } // apache::thrift::transport 0072 0073 #endif // _THRIFT_TRANSPORT_WINDOWS_TWINSOCKSINGLETON_H_
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|