-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix create log directory thread-unsafe #5326
Conversation
if (IsDirectory(dirname)) { return; } | ||
RecursivelyCreateDir(dirname); | ||
std::string remaining_dir = dirname; | ||
std::vector<std::string> sub_dirs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段代码提取个函数,最好不要引入重复
void TestMultiThreadsDirOperation(FileSystem* file_system) { | ||
std::string current_dir = GetCwd(); | ||
StringReplace(¤t_dir, '\\', '/'); | ||
std::string test_root_path = JoinPath(current_dir, "/tmp_multithread_test_dir"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
join path 第二个参数不需要加 / 吧
@@ -86,9 +86,26 @@ void TestDirOperation(FileSystem* file_system) { | |||
ASSERT_TRUE(!file_system->IsDirectory(test_root_path)); | |||
} | |||
|
|||
void CreateDirSimultaneously(FileSystem* file_system, const std::string& test_root_path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数名字不太对?建议直接写到thread的闭包
No description provided.