Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
0c41b876
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0c41b876
编写于
9月 10, 2017
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed insignificant error in Poco, shown by TSan [#CLICKHOUSE-2].
上级
2e741230
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
48 deletion
+53
-48
contrib/libpoco/Foundation/src/DirectoryWatcher.cpp
contrib/libpoco/Foundation/src/DirectoryWatcher.cpp
+35
-34
contrib/libpoco/Net/include/Poco/Net/HTTPServerConnection.h
contrib/libpoco/Net/include/Poco/Net/HTTPServerConnection.h
+4
-2
contrib/libpoco/Net/include/Poco/Net/TCPServerDispatcher.h
contrib/libpoco/Net/include/Poco/Net/TCPServerDispatcher.h
+14
-12
未找到文件。
contrib/libpoco/Foundation/src/DirectoryWatcher.cpp
浏览文件 @
0c41b876
...
...
@@ -45,6 +45,7 @@
#endif
#include <algorithm>
#include <map>
#include <atomic>
namespace
Poco
{
...
...
@@ -66,7 +67,7 @@ public:
{
return
_owner
;
}
virtual
void
run
()
=
0
;
virtual
void
stop
()
=
0
;
virtual
bool
supportsMoveEvents
()
const
=
0
;
...
...
@@ -78,21 +79,21 @@ protected:
size
(
0
)
{
}
ItemInfo
(
const
ItemInfo
&
other
)
:
path
(
other
.
path
),
size
(
other
.
size
),
lastModified
(
other
.
lastModified
)
{
}
explicit
ItemInfo
(
const
File
&
f
)
:
path
(
f
.
path
()),
size
(
f
.
isFile
()
?
f
.
getSize
()
:
0
),
lastModified
(
f
.
getLastModified
())
{
}
std
::
string
path
;
File
::
FileSize
size
;
Timestamp
lastModified
;
...
...
@@ -109,7 +110,7 @@ protected:
++
it
;
}
}
void
compare
(
ItemInfoMap
&
oldEntries
,
ItemInfoMap
&
newEntries
)
{
for
(
ItemInfoMap
::
iterator
itn
=
newEntries
.
begin
();
itn
!=
newEntries
.
end
();
++
itn
)
...
...
@@ -150,7 +151,7 @@ private:
DirectoryWatcherStrategy
();
DirectoryWatcherStrategy
(
const
DirectoryWatcherStrategy
&
);
DirectoryWatcherStrategy
&
operator
=
(
const
DirectoryWatcherStrategy
&
);
DirectoryWatcher
&
_owner
;
};
...
...
@@ -168,21 +169,21 @@ public:
if
(
!
_hStopped
)
throw
SystemException
(
"cannot create event"
);
}
~
WindowsDirectoryWatcherStrategy
()
{
CloseHandle
(
_hStopped
);
}
void
run
()
{
ItemInfoMap
entries
;
scan
(
entries
);
DWORD
filter
=
FILE_NOTIFY_CHANGE_FILE_NAME
|
FILE_NOTIFY_CHANGE_DIR_NAME
;
if
(
owner
().
eventMask
()
&
DirectoryWatcher
::
DW_ITEM_MODIFIED
)
filter
|=
FILE_NOTIFY_CHANGE_SIZE
|
FILE_NOTIFY_CHANGE_LAST_WRITE
;
std
::
string
path
(
owner
().
directory
().
path
());
#if defined(POCO_WIN32_UTF8)
std
::
wstring
upath
;
...
...
@@ -204,7 +205,7 @@ public:
}
return
;
}
bool
stopped
=
false
;
while
(
!
stopped
)
{
...
...
@@ -237,21 +238,21 @@ public:
catch
(
Poco
::
Exception
&
exc
)
{
owner
().
scanError
(
&
owner
(),
exc
);
}
}
}
FindCloseChangeNotification
(
hChange
);
}
void
stop
()
{
SetEvent
(
_hStopped
);
}
bool
supportsMoveEvents
()
const
{
return
false
;
}
private:
HANDLE
_hStopped
;
};
...
...
@@ -271,12 +272,12 @@ public:
_fd
=
inotify_init
();
if
(
_fd
==
-
1
)
throw
Poco
::
IOException
(
"cannot initialize inotify"
,
errno
);
}
~
LinuxDirectoryWatcherStrategy
()
{
close
(
_fd
);
}
void
run
()
{
int
mask
=
0
;
...
...
@@ -302,7 +303,7 @@ public:
owner
().
scanError
(
&
owner
(),
exc
);
}
}
Poco
::
Buffer
<
char
>
buffer
(
4096
);
while
(
!
_stopped
)
{
...
...
@@ -323,16 +324,16 @@ public:
while
(
n
>
0
)
{
struct
inotify_event
*
pEvent
=
reinterpret_cast
<
struct
inotify_event
*>
(
buffer
.
begin
()
+
i
);
if
(
pEvent
->
len
>
0
)
{
{
if
(
!
owner
().
eventsSuspended
())
{
Poco
::
Path
p
(
owner
().
directory
().
path
());
p
.
makeDirectory
();
p
.
setFileName
(
pEvent
->
name
);
Poco
::
File
f
(
p
.
toString
());
if
((
pEvent
->
mask
&
IN_CREATE
)
&&
(
owner
().
eventMask
()
&
DirectoryWatcher
::
DW_ITEM_ADDED
))
{
DirectoryWatcher
::
DirectoryEvent
ev
(
f
,
DirectoryWatcher
::
DW_ITEM_ADDED
);
...
...
@@ -360,7 +361,7 @@ public:
}
}
}
i
+=
sizeof
(
inotify_event
)
+
pEvent
->
len
;
n
-=
sizeof
(
inotify_event
)
+
pEvent
->
len
;
}
...
...
@@ -368,12 +369,12 @@ public:
}
}
}
void
stop
()
{
_stopped
=
true
;
}
bool
supportsMoveEvents
()
const
{
return
true
;
...
...
@@ -381,7 +382,7 @@ public:
private:
int
_fd
;
bool
_stopped
;
std
::
atomic
<
bool
>
_stopped
;
};
...
...
@@ -464,7 +465,7 @@ public:
private:
int
_queueFD
;
int
_dirFD
;
bool
_stopped
;
std
::
atomic
<
bool
>
_stopped
;
};
...
...
@@ -478,11 +479,11 @@ public:
DirectoryWatcherStrategy
(
owner
)
{
}
~
PollingDirectoryWatcherStrategy
()
{
}
void
run
()
{
ItemInfoMap
entries
;
...
...
@@ -502,7 +503,7 @@ public:
}
}
}
void
stop
()
{
_stopped
.
set
();
...
...
@@ -529,7 +530,7 @@ DirectoryWatcher::DirectoryWatcher(const std::string& path, int eventMask, int s
init
();
}
DirectoryWatcher
::
DirectoryWatcher
(
const
Poco
::
File
&
directory
,
int
eventMask
,
int
scanInterval
)
:
_directory
(
directory
),
_eventMask
(
eventMask
),
...
...
@@ -552,11 +553,11 @@ DirectoryWatcher::~DirectoryWatcher()
}
}
void
DirectoryWatcher
::
suspendEvents
()
{
poco_assert
(
_eventsSuspended
>
0
);
_eventsSuspended
--
;
}
...
...
@@ -571,7 +572,7 @@ void DirectoryWatcher::init()
{
if
(
!
_directory
.
exists
())
throw
Poco
::
FileNotFoundException
(
_directory
.
path
());
if
(
!
_directory
.
isDirectory
())
throw
Poco
::
InvalidArgumentException
(
"not a directory"
,
_directory
.
path
());
...
...
@@ -587,7 +588,7 @@ void DirectoryWatcher::init()
_thread
.
start
(
*
this
);
}
void
DirectoryWatcher
::
run
()
{
_pStrategy
->
run
();
...
...
contrib/libpoco/Net/include/Poco/Net/HTTPServerConnection.h
浏览文件 @
0c41b876
...
...
@@ -27,6 +27,8 @@
#include "Poco/Net/HTTPServerParams.h"
#include "Poco/Mutex.h"
#include <atomic>
namespace
Poco
{
namespace
Net
{
...
...
@@ -45,7 +47,7 @@ public:
virtual
~
HTTPServerConnection
();
/// Destroys the HTTPServerConnection.
void
run
();
/// Handles all HTTP requests coming in.
...
...
@@ -56,7 +58,7 @@ protected:
private:
HTTPServerParams
::
Ptr
_pParams
;
HTTPRequestHandlerFactory
::
Ptr
_pFactory
;
bool
_stopped
;
std
::
atomic
<
bool
>
_stopped
;
Poco
::
FastMutex
_mutex
;
};
...
...
contrib/libpoco/Net/include/Poco/Net/TCPServerDispatcher.h
浏览文件 @
0c41b876
...
...
@@ -29,6 +29,8 @@
#include "Poco/ThreadPool.h"
#include "Poco/Mutex.h"
#include <atomic>
namespace
Poco
{
namespace
Net
{
...
...
@@ -52,35 +54,35 @@ public:
void
release
();
/// Decrements the object's reference count
/// and deletes the object if the count
/// reaches zero.
/// reaches zero.
void
run
();
/// Runs the dispatcher.
void
enqueue
(
const
StreamSocket
&
socket
);
/// Queues the given socket connection.
void
stop
();
/// Stops the dispatcher.
int
currentThreads
()
const
;
/// Returns the number of currently used threads.
int
maxThreads
()
const
;
/// Returns the maximum number of threads available.
int
totalConnections
()
const
;
/// Returns the total number of handled connections.
int
currentConnections
()
const
;
/// Returns the number of currently handled connections.
/// Returns the number of currently handled connections.
int
maxConcurrentConnections
()
const
;
/// Returns the maximum number of concurrently handled connections.
/// Returns the maximum number of concurrently handled connections.
int
queuedConnections
()
const
;
/// Returns the number of queued connections.
/// Returns the number of queued connections.
int
refusedConnections
()
const
;
/// Returns the number of refused connections.
...
...
@@ -93,7 +95,7 @@ protected:
void
beginConnection
();
/// Updates the performance counters.
void
endConnection
();
/// Updates the performance counters.
...
...
@@ -109,7 +111,7 @@ private:
int
_currentConnections
;
int
_maxConcurrentConnections
;
int
_refusedConnections
;
bool
_stopped
;
std
::
atomic
<
bool
>
_stopped
;
Poco
::
NotificationQueue
_queue
;
TCPServerConnectionFactory
::
Ptr
_pConnectionFactory
;
Poco
::
ThreadPool
&
_threadPool
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录