You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/12/17 17:05:51 UTC

[GitHub] [geode-native] pivotal-jbarrett commented on a change in pull request #715: GEODE-8793: Fix PdxTypeRegistry cleanup

pivotal-jbarrett commented on a change in pull request #715:
URL: https://github.com/apache/geode-native/pull/715#discussion_r545245741



##########
File path: cppcache/src/ThinClientPoolDM.cpp
##########
@@ -48,6 +48,11 @@
     x = nullptr;              \
   } while (0)
 
+namespace {
+const char* const NC_ClearPdxTypeRegistry_Thread =
+    "NC_clearPdxTypeRegistryCallback";

Review comment:
       I have been inlining these task/thread names since nothing else but the task uses them.

##########
File path: cppcache/src/ClientMetadataService.cpp
##########
@@ -59,9 +59,11 @@ void ClientMetadataService::start() {
 }
 
 void ClientMetadataService::stop() {
-  m_run = false;
-  m_regionQueueCondition.notify_one();
-  m_thread.join();
+  if (m_run) {

Review comment:
       Perhaps this should be a test and set atomic operation. Only enter this block if the value was true and this thread sets it to false.

##########
File path: cppcache/src/ThinClientPoolDM.cpp
##########
@@ -791,13 +792,22 @@ void ThinClientPoolDM::stopUpdateLocatorListThread() {
   }
 }
 
-void ThinClientPoolDM::stopCliCallbackThread() {
-  if (m_cliCallbackTask) {
-    LOGFINE("ThinClientPoolDM::destroy(): Closing cliCallback thread.");
-    m_cliCallbackTask->stopNoblock();
-    m_cliCallbackSema.release();
-    m_cliCallbackTask->wait();
-    m_cliCallbackTask = nullptr;
+void ThinClientPoolDM::startClearPdxTypeRegistryThread() {

Review comment:
       I wonder why this isn't just done inline with the thread that triggers the semaphore? Why is this even a background thread just waiting for infrequent events? If it needs to be asynchronous for some reason we could use one of the many thread pools we have or other asynchronous methods to invoke it on demand. This eliminates a seemingly pointless semaphore.

##########
File path: cppcache/src/util/concurrent/binary_semaphore.hpp
##########
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef GEODE_UTIL_CONCURRENT_BINARY_SEMAPHORE_H_
+#define GEODE_UTIL_CONCURRENT_BINARY_SEMAPHORE_H_
+
+#include <condition_variable>
+#include <mutex>
+
+namespace apache {
+namespace geode {
+namespace util {
+namespace concurrent {
+class binary_semaphore {

Review comment:
       AWESOME! Will come in handy removing ACE semaphores.




----------------------------------------------------------------
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:
users@infra.apache.org