[GitHub] [mesos] bluezd commented on a change in pull request #353: Hook manager mutex and global variable enhancement.

2020-03-24 Thread GitBox
bluezd commented on a change in pull request #353: Hook manager mutex and 
global variable enhancement.
URL: https://github.com/apache/mesos/pull/353#discussion_r397585853
 
 

 ##
 File path: src/hook/manager.cpp
 ##
 @@ -47,16 +47,16 @@ using mesos::modules::ModuleManager;
 namespace mesos {
 namespace internal {
 
-static std::mutex mutex;
-static LinkedHashMap availableHooks;
+static std::mutex* mutex = new(std::mutex);
+static LinkedHashMap* availableHooks = 
new(LinkedHashMap);
 
 Review comment:
   Thanks for your info, just installed the commit hook and make changes to the 
code accordingly per your suggestion.
   
   Could you help reviewing it again ? @bmahler 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mesos] bluezd commented on a change in pull request #353: Hook manager mutex and global variable enhancement.

2020-03-24 Thread GitBox
bluezd commented on a change in pull request #353: Hook manager mutex and 
global variable enhancement.
URL: https://github.com/apache/mesos/pull/353#discussion_r397585853
 
 

 ##
 File path: src/hook/manager.cpp
 ##
 @@ -47,16 +47,16 @@ using mesos::modules::ModuleManager;
 namespace mesos {
 namespace internal {
 
-static std::mutex mutex;
-static LinkedHashMap availableHooks;
+static std::mutex* mutex = new(std::mutex);
+static LinkedHashMap* availableHooks = 
new(LinkedHashMap);
 
 Review comment:
   Thanks for your info, just installed the commit hook and make changes to the 
code accordingly per your suggestion.
   
   Could you help reviewing it again ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mesos] bluezd commented on a change in pull request #353: hook manager mutex and global variable enhancement

2020-03-24 Thread GitBox
bluezd commented on a change in pull request #353: hook manager mutex and 
global variable enhancement
URL: https://github.com/apache/mesos/pull/353#discussion_r397585853
 
 

 ##
 File path: src/hook/manager.cpp
 ##
 @@ -47,16 +47,16 @@ using mesos::modules::ModuleManager;
 namespace mesos {
 namespace internal {
 
-static std::mutex mutex;
-static LinkedHashMap availableHooks;
+static std::mutex* mutex = new(std::mutex);
+static LinkedHashMap* availableHooks = 
new(LinkedHashMap);
 
 Review comment:
   Thanks for your info, just installed the commit hook and make changes to the 
code accordingly per your suggestion.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mesos] bluezd commented on a change in pull request #353: hook manager mutex and global variable enhancement

2020-03-23 Thread GitBox
bluezd commented on a change in pull request #353: hook manager mutex and 
global variable enhancement
URL: https://github.com/apache/mesos/pull/353#discussion_r396867472
 
 

 ##
 File path: src/hook/manager.cpp
 ##
 @@ -240,18 +242,20 @@ Future
   // `DockerTaskExecutorPrepareInfo` can be deterministically resolved
   // (the last hook takes priority).
   vector>> futures;
-  futures.reserve(availableHooks.size());
-
-  foreachvalue (Hook* hook, availableHooks) {
-// Chain together each hook.
-futures.push_back(
-hook->slavePreLaunchDockerTaskExecutorDecorator(
-taskInfo,
-executorInfo,
-containerName,
-containerWorkDirectory,
-mappedSandboxDirectory,
-env));
+  synchronized (mutex) {
+futures.reserve((*availableHooks).size());
 
 Review comment:
   Agree with it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mesos] bluezd commented on a change in pull request #353: hook manager mutex and global variable enhancement

2020-03-23 Thread GitBox
bluezd commented on a change in pull request #353: hook manager mutex and 
global variable enhancement
URL: https://github.com/apache/mesos/pull/353#discussion_r396867675
 
 

 ##
 File path: src/hook/manager.cpp
 ##
 @@ -47,16 +47,16 @@ using mesos::modules::ModuleManager;
 namespace mesos {
 namespace internal {
 
-static std::mutex mutex;
-static LinkedHashMap availableHooks;
+static std::mutex *mutex = new(std::mutex);
+static LinkedHashMap *availableHooks = 
new(LinkedHashMap);
 
 Review comment:
   Roger that.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services