celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject celix git commit: CELIX-370: Updates usage of std::thread for dep man c++. Should be compile for Mac
Date Wed, 20 Jul 2016 18:42:19 GMT
Repository: celix
Updated Branches:
  refs/heads/develop d1abcd05d -> dc6cafd9f


CELIX-370: Updates usage of std::thread for dep man c++. Should be compile for Mac


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/dc6cafd9
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/dc6cafd9
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/dc6cafd9

Branch: refs/heads/develop
Commit: dc6cafd9f4815b2932a92ecec97919468b7e25a5
Parents: d1abcd0
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Wed Jul 20 20:45:06 2016 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Wed Jul 20 20:45:06 2016 +0200

----------------------------------------------------------------------
 examples/dm_example_cxx/phase3/CMakeLists.txt   |  4 +-
 .../dm_example_cxx/phase3/include/Phase3Cmp.h   |  6 +-
 .../phase3/src/Phase3Activator.cc               | 45 ++++++++++++++
 examples/dm_example_cxx/phase3/src/Phase3Cmp.cc | 63 ++++++++++++++++++++
 .../phase3/src/Phase3LockingActivator.cc        | 45 --------------
 .../phase3/src/Phase3LockingCmp.cc              | 63 --------------------
 .../include/Phase3LockingActivator.h            |  6 +-
 .../phase3_locking/include/Phase3LockingCmp.h   |  6 +-
 .../phase3_locking/src/Phase3LockingCmp.cc      |  5 +-
 9 files changed, 122 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/dc6cafd9/examples/dm_example_cxx/phase3/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/CMakeLists.txt b/examples/dm_example_cxx/phase3/CMakeLists.txt
index 4fa498c..8877ac2 100644
--- a/examples/dm_example_cxx/phase3/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase3/CMakeLists.txt
@@ -24,8 +24,8 @@ add_bundle(phase3_cxx
     SYMBOLIC_NAME phase3_cxx
     VERSION 0.0.1
     SOURCES
-        src/Phase3LockingActivator.cc
-        src/Phase3LockingCmp.cc
+        src/Phase3Activator.cc
+        src/Phase3Cmp.cc
 )
 
 

http://git-wip-us.apache.org/repos/asf/celix/blob/dc6cafd9/examples/dm_example_cxx/phase3/include/Phase3Cmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/include/Phase3Cmp.h b/examples/dm_example_cxx/phase3/include/Phase3Cmp.h
index a4d4bad..8b7e974 100644
--- a/examples/dm_example_cxx/phase3/include/Phase3Cmp.h
+++ b/examples/dm_example_cxx/phase3/include/Phase3Cmp.h
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#ifndef CELIX_PHASE2CMP_H
-#define CELIX_PHASE2CMP_H
+#ifndef CELIX_PHASE3CMP_H
+#define CELIX_PHASE3CMP_H
 
 #include "IPhase1.h"
 #include "IPhase2.h"
@@ -47,4 +47,4 @@ public:
     void setPhase2a(IPhase2* phase);
 };
 
-#endif //CELIX_PHASE2CMP_H
+#endif //CELIX_PHASE3CMP_H

http://git-wip-us.apache.org/repos/asf/celix/blob/dc6cafd9/examples/dm_example_cxx/phase3/src/Phase3Activator.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/src/Phase3Activator.cc b/examples/dm_example_cxx/phase3/src/Phase3Activator.cc
new file mode 100644
index 0000000..76a6eaa
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/src/Phase3Activator.cc
@@ -0,0 +1,45 @@
+/**
+ * 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.
+ */
+
+
+#include "Phase3Cmp.h"
+#include "Phase3Activator.h"
+
+using namespace celix::dm;
+
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new Phase3Activator(mng);
+}
+
+void Phase3Activator::init(DependencyManager& manager) {
+    add(createComponent<Phase3Cmp>()
+        //NOTE no setInstance -> lazy initialization using the default constructor
+        .setCallbacks(nullptr, &Phase3Cmp::start, &Phase3Cmp::stop, nullptr)
+        .add(createServiceDependency<Phase3Cmp,IPhase2>()
+            .setRequired(true)
+            .setCallbacks(&Phase3Cmp::addPhase2, &Phase3Cmp::removePhase2)
+        )
+        .add(createServiceDependency<Phase3Cmp,IPhase2>()
+             .setRequired(false)
+             .setFilter("(&(name=phase2a)(non-existing=*))")
+             .setCallbacks(&Phase3Cmp::setPhase2a)
+        )
+    );
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/dc6cafd9/examples/dm_example_cxx/phase3/src/Phase3Cmp.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/src/Phase3Cmp.cc b/examples/dm_example_cxx/phase3/src/Phase3Cmp.cc
new file mode 100644
index 0000000..e0f4722
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/src/Phase3Cmp.cc
@@ -0,0 +1,63 @@
+/**
+ * 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.
+ */
+
+#include "Phase3Cmp.h"
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
+#include <thread>
+#include <chrono>
+
+void Phase3Cmp::start() {
+    std::cout << "start Phase3Cmp\n";
+    running = true;
+    pollThread = std::thread {&Phase3Cmp::poll, this};
+}
+
+void Phase3Cmp::stop() {
+    std::cout << "stop Phase3Cmp\n";
+    running = false;
+    pollThread.join();
+}
+
+void Phase3Cmp::poll() {
+    while (running) {
+        std::cout << "polling Phase3Cmp\n";
+        for (std::pair<IPhase2*, celix::dm::Properties> pair : this->phases) {
+            std::string name = pair.second["name"];
+            std::cout << "current data for " << name << " is " <<
pair.first->getData() << "\n";
+        }
+        std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+    }
+}
+
+void Phase3Cmp::addPhase2(IPhase2* phase2, celix::dm::Properties&& props) {
+    std::cout << "adding Iphase2 for Phase3Cmp\n";
+    std::pair<IPhase2*, celix::dm::Properties> pair {phase2, props};
+    this->phases[phase2] = props;
+}
+
+void Phase3Cmp::removePhase2(IPhase2* phase2, celix::dm::Properties&& props) {
+    std::cout << "adding Iphase2 for Phase3Cmp\n";
+    this->phases.erase(phase2);
+}
+
+void Phase3Cmp::setPhase2a(IPhase2* phase) {
+    std::cout << "setting phase2a\n";
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/dc6cafd9/examples/dm_example_cxx/phase3/src/Phase3LockingActivator.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/src/Phase3LockingActivator.cc b/examples/dm_example_cxx/phase3/src/Phase3LockingActivator.cc
deleted file mode 100644
index 43825e9..0000000
--- a/examples/dm_example_cxx/phase3/src/Phase3LockingActivator.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.
- */
-
-
-#include "Phase3Cmp.h"
-#include "Phase3Activator.h"
-
-using namespace celix::dm;
-
-
-DmActivator* DmActivator::create(DependencyManager& mng) {
-    return new Phase3Activator(mng);
-}
-
-void Phase3Activator::init(DependencyManager& manager) {
-    add(createComponent<Phase3Cmp>()
-        //NOTE no setInstance -> lazy initialization using the default constructor
-        .setCallbacks(nullptr, &Phase3Cmp::start, &Phase3Cmp::stop, nullptr)
-        .add(createServiceDependency<Phase3Cmp,IPhase2>()
-            .setRequired(true)
-            .setCallbacks(&Phase3Cmp::addPhase2, &Phase3Cmp::removePhase2)
-        )
-        .add(createServiceDependency<Phase3Cmp,IPhase2>()
-             .setRequired(false)
-             .setFilter("(&(name=phase2a)(non-existing=*))")
-             .setCallbacks(&Phase3Cmp::setPhase2a)
-        )
-    );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/dc6cafd9/examples/dm_example_cxx/phase3/src/Phase3LockingCmp.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/src/Phase3LockingCmp.cc b/examples/dm_example_cxx/phase3/src/Phase3LockingCmp.cc
deleted file mode 100644
index 8eeafe6..0000000
--- a/examples/dm_example_cxx/phase3/src/Phase3LockingCmp.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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.
- */
-
-#include "Phase3Cmp.h"
-#include <iostream>
-#include <stdlib.h>
-#include <stdio.h>
-#include <thread>
-#include <chrono>
-
-void Phase3Cmp::start() {
-    std::cout << "start Phase3Cmp\n";
-    running = true;
-    pollThread = std::thread {&Phase3Cmp::poll, std::ref(*this)};
-}
-
-void Phase3Cmp::stop() {
-    std::cout << "stop Phase3Cmp\n";
-    running = false;
-    pollThread.join();
-}
-
-void Phase3Cmp::poll() {
-    while (running) {
-        std::cout << "polling Phase3Cmp\n";
-        for (std::pair<IPhase2*, celix::dm::Properties> pair : this->phases) {
-            std::string name = pair.second["name"];
-            std::cout << "current data for " << name << " is " <<
pair.first->getData() << "\n";
-        }
-        std::this_thread::sleep_for(std::chrono::milliseconds(1000));
-    }
-}
-
-void Phase3Cmp::addPhase2(IPhase2* phase2, celix::dm::Properties&& props) {
-    std::cout << "adding Iphase2 for Phase3Cmp\n";
-    std::pair<IPhase2*, celix::dm::Properties> pair {phase2, props};
-    this->phases[phase2] = props;
-}
-
-void Phase3Cmp::removePhase2(IPhase2* phase2, celix::dm::Properties&& props) {
-    std::cout << "adding Iphase2 for Phase3Cmp\n";
-    this->phases.erase(phase2);
-}
-
-void Phase3Cmp::setPhase2a(IPhase2* phase) {
-    std::cout << "setting phase2a\n";
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/dc6cafd9/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h b/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h
index 1b7f7a1..9a84dc9 100644
--- a/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h
+++ b/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#ifndef CELIX_PHASE3ACTIVATOR_H
-#define CELIX_PHASE3ACTIVATOR_H
+#ifndef CELIX_PHASE3LOCKINGACTIVATOR_H
+#define CELIX_PHASE3LOCKINGACTIVATOR_H
 
 #include "celix/dm/DmActivator.h"
 
@@ -30,4 +30,4 @@ public:
     virtual void init(DependencyManager& manager);
 };
 
-#endif //CELIX_PHASE2AACTIVATOR_H
+#endif //CELIX_PHASE3LOCKINGAACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/dc6cafd9/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h b/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h
index c56fe60..678fa80 100644
--- a/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h
+++ b/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-#ifndef CELIX_PHASE2CMP_H
-#define CELIX_PHASE2CMP_H
+#ifndef CELIX_PHASE3LOCKINGCMP_H
+#define CELIX_PHASE3LOCKINGCMP_H
 
 #include "IPhase2.h"
 #include <stdint.h>
@@ -47,4 +47,4 @@ public:
     void removePhase2(IPhase2* phase, celix::dm::Properties&& props); //injector
used by dependency manager
 };
 
-#endif //CELIX_PHASE2CMP_H
+#endif //CELIX_PHASE3LOCKINGCMP_H

http://git-wip-us.apache.org/repos/asf/celix/blob/dc6cafd9/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.cc
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.cc b/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.cc
index 382c112..ead0b12 100644
--- a/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.cc
+++ b/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.cc
@@ -27,7 +27,8 @@
 void Phase3LockingCmp::start() {
     std::cout << "start Phase3LockingCmp\n";
     running = true;
-    pollThread = std::thread {&Phase3LockingCmp::poll, std::ref(*this)};
+    //pollThread = std::thread {&Phase3LockingCmp::poll, std::ref(*this)};
+    pollThread = std::thread {&Phase3LockingCmp::poll, this};
 }
 
 void Phase3LockingCmp::stop() {
@@ -60,4 +61,4 @@ void Phase3LockingCmp::removePhase2(IPhase2* phase2, celix::dm::Properties&&
pro
     std::cout << "adding Iphase2 for Phase3LockingCmp\n";
     std::lock_guard<std::mutex> lock(mutex);
     this->phases.erase(phase2);
-}
\ No newline at end of file
+}


Mime
View raw message