proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
SocketPair.h
Go to the documentation of this file.
1
/*
2
* Copyright 2014-present Facebook, Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#pragma once
18
19
namespace
folly
{
20
21
class
SocketPair
{
22
public
:
23
enum
Mode
{
BLOCKING
,
NONBLOCKING
};
24
25
explicit
SocketPair
(
Mode
mode
= NONBLOCKING);
26
~SocketPair
();
27
28
int
operator[]
(
int
index)
const
{
29
return
fds_
[index];
30
}
31
32
void
closeFD0
();
33
void
closeFD1
();
34
35
int
extractFD0
() {
36
return
extractFD
(0);
37
}
38
int
extractFD1
() {
39
return
extractFD
(1);
40
}
41
int
extractFD
(
int
index) {
42
int
fd =
fds_
[index];
43
fds_
[index] = -1;
44
return
fd;
45
}
46
47
private
:
48
int
fds_
[2];
49
};
50
51
}
// namespace folly
folly::SocketPair::NONBLOCKING
Definition:
SocketPair.h:23
folly
—— Concurrent Priority Queue Implementation ——
Definition:
AtomicBitSet.h:29
folly::SocketPair::Mode
Mode
Definition:
SocketPair.h:23
mode
folly::Optional< PskKeyExchangeMode > mode
Definition:
ClientProtocol.cpp:778
folly::SocketPair
Definition:
SocketPair.h:21
folly::SocketPair::extractFD1
int extractFD1()
Definition:
SocketPair.h:38
folly::SocketPair::BLOCKING
Definition:
SocketPair.h:23
folly::SocketPair::extractFD
int extractFD(int index)
Definition:
SocketPair.h:41
folly::SocketPair::closeFD1
void closeFD1()
Definition:
SocketPair.cpp:63
folly::SocketPair::operator[]
int operator[](int index) const
Definition:
SocketPair.h:28
folly::SocketPair::fds_
int fds_[2]
Definition:
SocketPair.h:48
folly::SocketPair::extractFD0
int extractFD0()
Definition:
SocketPair.h:35
folly::SocketPair::closeFD0
void closeFD0()
Definition:
SocketPair.cpp:56
folly::SocketPair::~SocketPair
~SocketPair()
Definition:
SocketPair.cpp:51
folly::SocketPair::SocketPair
SocketPair(Mode mode=NONBLOCKING)
Definition:
SocketPair.cpp:29
proxygen
folly
folly
io
async
test
SocketPair.h
Generated by
1.8.11