CELIX-282: Removes superfluous examples.

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

Branch: refs/heads/release/celix-2.0.0
Commit: 505f6a8460ca885e5d92c6ee3448114956fb7aaa
Parents: 210f87c
Author: Pepijn Noltes <pepijnnol...@gmail.com>
Authored: Sun Oct 16 13:38:10 2016 +0200
Committer: Pepijn Noltes <pepijnnol...@gmail.com>
Committed: Sun Oct 16 13:38:10 2016 +0200

----------------------------------------------------------------------
 examples/CMakeLists.txt                         |  28 +-
 examples/echo_service/CMakeLists.txt            |  19 -
 examples/echo_service/client/CMakeLists.txt     |  33 --
 .../private/include/echo_client_private.h       |  49 ---
 .../client/private/src/echo_client.c            |  78 ----
 .../client/private/src/echo_client_activator.c  |  83 -----
 examples/echo_service/server/CMakeLists.txt     |  32 --
 .../private/include/echo_server_private.h       |  36 --
 .../server/private/src/echo_server.c            |  49 ---
 .../server/private/src/echo_server_activator.c  |  78 ----
 .../server/public/include/echo_server.h         |  41 --
 examples/embedding/private/src/main.c           |   1 +
 examples/hello_world/CMakeLists.txt             |   2 +-
 examples/locking/CMakeLists.txt                 |  34 --
 examples/locking/benchmark/CMakeLists.txt       |  31 --
 .../private/src/benchmark_runner_activator.c    | 290 ---------------
 .../benchmark/public/include/benchmark.h        |  41 --
 .../benchmark/public/include/benchmark_result.h |  33 --
 .../benchmark/public/src/benchmark_activator.c  | 119 ------
 examples/locking/consumer.c                     | 372 -------------------
 examples/locking/math_provider/CMakeLists.txt   |  32 --
 .../private/include/math_component.h            |  32 --
 .../math_provider/private/src/math_component.c  |  41 --
 .../private/src/provider_activator.c            | 228 ------------
 .../modified_bool_benchmark/CMakeLists.txt      |  29 --
 .../private/src/modified_bool_benchmark.c       | 180 ---------
 examples/locking/mutex_benchmark/CMakeLists.txt |  32 --
 .../private/src/mutex_benchmark.c               | 135 -------
 .../locking/reference_benchmark/CMakeLists.txt  |  29 --
 .../private/src/reference_benchmark.c           | 128 -------
 examples/locking/services/benchmark_service.h   |  39 --
 examples/locking/services/frequency_service.h   |  47 ---
 examples/locking/services/math_service.h        |  40 --
 .../locking/start_stop_benchmark/CMakeLists.txt |  29 --
 .../private/src/start_stop_benchmark.c          | 201 ----------
 examples/mongoose/CMakeLists.txt                |   2 +
 .../chapter01-greeting-example/CMakeLists.txt   |  19 -
 .../chapter01-greeting-example/README.TXT       |  24 --
 .../client/CMakeLists.txt                       |  21 --
 .../client/private/src/client.c                 |  65 ----
 .../greeting/CMakeLists.txt                     |  28 --
 .../greeting/private/include/greeting_impl.h    |  38 --
 .../greeting/private/src/activator.c            |  91 -----
 .../greeting/private/src/greeting_impl.c        |  32 --
 .../greeting/public/include/greeting_service.h  |  39 --
 .../chapter04-correct-listener/CMakeLists.txt   |  22 --
 .../chapter04-correct-listener/README.TXT       |  23 --
 .../private/src/listener_example.c              | 197 ----------
 .../chapter04-correct-lookup/CMakeLists.txt     |  21 --
 .../private/src/activator.c                     | 179 ---------
 .../chapter04-paint-example/CMakeLists.txt      |  31 --
 .../circle/CMakeLists.txt                       |  46 ---
 .../circle/private/include/circle_shape.h       |  33 --
 .../circle/private/src/activator.c              |  82 ----
 .../circle/private/src/circle.png               | Bin 1664 -> 0 bytes
 .../circle/private/src/circle_shape.c           | 109 ------
 .../paint/CMakeLists.txt                        |  53 ---
 .../chapter04-paint-example/paint/gtktest.glade |  59 ---
 .../paint/private/include/default_shape.h       |  31 --
 .../paint/private/include/paint_frame.h         |  59 ---
 .../paint/private/include/shape_component.h     |  45 ---
 .../paint/private/src/activator.c               | 139 -------
 .../paint/private/src/default_shape.c           |  96 -----
 .../paint/private/src/paint_frame.c             | 363 ------------------
 .../paint/private/src/shape_component.c         |  69 ----
 .../paint/private/src/underc.png                | Bin 526 -> 0 bytes
 .../simple/public/include/simple_shape.h        |  42 ---
 .../square/CMakeLists.txt                       |  45 ---
 .../square/private/include/square_shape.h       |  31 --
 .../square/private/src/activator.c              |  77 ----
 .../square/private/src/square.png               | Bin 351 -> 0 bytes
 .../square/private/src/square_shape.c           |  95 -----
 .../triangle/CMakeLists.txt                     |  45 ---
 .../triangle/private/include/triangle_shape.h   |  32 --
 .../triangle/private/src/activator.c            |  77 ----
 .../triangle/private/src/triangle.png           | Bin 1375 -> 0 bytes
 .../triangle/private/src/triangle_shape.c       |  97 -----
 examples/producer_consumer/CMakeLists.txt       |  20 -
 .../producer_consumer/consumer/CMakeLists.txt   |  27 --
 .../consumer/private/src/activator.c            | 195 ----------
 .../producer_consumer/database/CMakeLists.txt   |  30 --
 .../private/include/reader_service_impl.h       |  39 --
 .../private/include/writer_service_impl.h       |  40 --
 .../database/private/src/activator.c            | 157 --------
 .../database/private/src/reader.c               |  73 ----
 .../database/private/src/writer.c               |  68 ----
 .../database/public/include/data.h              |  38 --
 .../database/public/include/database.h          |  44 ---
 .../database/public/include/reader_service.h    |  50 ---
 .../database/public/include/writer_service.h    |  48 ---
 .../producer_consumer/producer/CMakeLists.txt   |  27 --
 .../producer/private/src/activator.c            | 162 --------
 examples/whiteboard/CMakeLists.txt              |   5 +-
 93 files changed, 11 insertions(+), 6240 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 0e3f87e..5192ee3 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -22,35 +22,13 @@ if (EXAMPLES)
     add_subdirectory(services_example_c)
     add_subdirectory(services_example_cxx)
 
+    add_subdirectory(dm_example)
+    add_subdirectory(dm_example_cxx)
+
     if (NOT ANDROID)
        add_subdirectory(mongoose)
     endif()
- 
     add_subdirectory(whiteboard)
-    add_subdirectory(echo_service)
-    add_subdirectory(producer_consumer)
-    add_subdirectory(dm_example)
-    add_subdirectory(dm_example_cxx)
-    
-    add_subdirectory(osgi-in-action/chapter04-correct-lookup)
-    add_subdirectory(osgi-in-action/chapter04-correct-listener)
-    add_subdirectory(osgi-in-action/chapter01-greeting-example)
-    #add_subdirectory(osgi-in-action/chapter04-paint-example) chapter4 example 
is still based on APR
-    add_subdirectory(locking)
-    
     add_subdirectory(embedding)
 
-    add_deploy(chapter01-greeting-example-d BUNDLES shell shell_tui 
log_service chapter01-greeting-example-client chapter01-greeting-example)
-    add_deploy(chapter04-correct-lookup-d BUNDLES shell shell_tui log_service 
chapter04-correct-lookup)
-    add_deploy(chapter04-correct-listener-d BUNDLES shell shell_tui 
log_service chapter04-correct-listener)
-
-    #deploy("hello_world" BUNDLES shell shell_tui 
apache_celix_examples_hello_world hello_world_test log_service log_writer)
-    add_deploy("wb" BUNDLES tracker publisherA publisherB shell shell_tui 
log_service log_writer)
-    add_deploy("wb_dp" BUNDLES tracker_depman publisherA publisherB shell 
shell_tui log_service log_writer dm_shell)
-    add_deploy("echo" BUNDLES echo_server echo_client shell shell_tui)
-    add_deploy("producer_consumer" BUNDLES producer consumer database shell 
shell_tui)
-    if (NOT ANDROID)
-        add_deploy("mongoose_deploy" BUNDLES shell shell_tui log_service 
mongoose)
-    endif ()
-
 endif(EXAMPLES)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/echo_service/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/echo_service/CMakeLists.txt 
b/examples/echo_service/CMakeLists.txt
deleted file mode 100644
index 0b4682c..0000000
--- a/examples/echo_service/CMakeLists.txt
+++ /dev/null
@@ -1,19 +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.
-
-add_subdirectory(server)
-add_subdirectory(client)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/echo_service/client/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/echo_service/client/CMakeLists.txt 
b/examples/echo_service/client/CMakeLists.txt
deleted file mode 100644
index de66952..0000000
--- a/examples/echo_service/client/CMakeLists.txt
+++ /dev/null
@@ -1,33 +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.
-
-add_bundle(echo_client
-       SYMBOLIC_NAME  "apache_celix_examples_echo_client"
-       VERSION "0.0.1"
-       NAME "Apache Celix Echo Client"
-       SOURCES
-               private/src/echo_client_activator
-               private/src/echo_client
-
-               private/include/echo_client_private.h
-)
-
-include_directories("private/include")
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("../server/public/include")
-target_link_libraries(echo_client celix_framework)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/echo_service/client/private/include/echo_client_private.h
----------------------------------------------------------------------
diff --git a/examples/echo_service/client/private/include/echo_client_private.h 
b/examples/echo_service/client/private/include/echo_client_private.h
deleted file mode 100644
index e57597a..0000000
--- a/examples/echo_service/client/private/include/echo_client_private.h
+++ /dev/null
@@ -1,49 +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.
- */
-/*
- * echo_client_private.h
- *
- *  \date       Sep 21, 2010
- *  \author            <a href="mailto:d...@celix.apache.org";>Apache Celix 
Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-
-#ifndef ECHO_CLIENT_PRIVATE_H_
-#define ECHO_CLIENT_PRIVATE_H_
-
-#include <celixbool.h>
-
-struct echoClient {
-       service_tracker_pt tracker;
-       bool running;
-       pthread_t sender_thread;
-       char *ident;
-};
-
-typedef struct echoClient * echo_client_pt;
-
-echo_client_pt echoClient_create(service_tracker_pt context);
-
-void echoClient_start(echo_client_pt client);
-void echoClient_stop(echo_client_pt client);
-
-void echoClient_destroy(echo_client_pt client);
-
-
-#endif /* ECHO_CLIENT_PRIVATE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/echo_service/client/private/src/echo_client.c
----------------------------------------------------------------------
diff --git a/examples/echo_service/client/private/src/echo_client.c 
b/examples/echo_service/client/private/src/echo_client.c
deleted file mode 100644
index 6670684..0000000
--- a/examples/echo_service/client/private/src/echo_client.c
+++ /dev/null
@@ -1,78 +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.
- */
-/*
- * echo_client.c
- *
- *  \date       Sep 21, 2010
- *  \author            <a href="mailto:d...@celix.apache.org";>Apache Celix 
Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
-
-#include "service_tracker.h"
-
-#include "echo_client_private.h"
-#include "echo_server.h"
-
-static void *trk_send(void *handle) {
-
-       echo_client_pt client = (echo_client_pt) handle;
-
-       while (client->running) {
-               echo_service_pt service = (echo_service_pt) 
serviceTracker_getService(client->tracker);
-               if (service != NULL) {
-                       service->echo(service->server, client->ident);
-               }
-               sleep(1);
-       }
-
-       pthread_exit(NULL);
-
-       return NULL;
-}
-
-echo_client_pt echoClient_create(service_tracker_pt echoServiceTracker) {
-       echo_client_pt client = malloc(sizeof(*client));
-
-       client->tracker = echoServiceTracker;
-       client->running = false;
-       client->ident = "OSX rules";
-
-       return client;
-}
-
-void echoClient_start(echo_client_pt client) {
-       client->running = true;
-       pthread_create(&client->sender_thread, NULL, trk_send, client);
-}
-
-void echoClient_stop(echo_client_pt client) {
-       client->running = false;
-       pthread_join(client->sender_thread, NULL);
-}
-
-void echoClient_destroy(echo_client_pt client) {
-       client->tracker = NULL;
-       client->sender_thread = 0;
-       free(client);
-       client = NULL;
-}
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/echo_service/client/private/src/echo_client_activator.c
----------------------------------------------------------------------
diff --git a/examples/echo_service/client/private/src/echo_client_activator.c 
b/examples/echo_service/client/private/src/echo_client_activator.c
deleted file mode 100644
index 4026886..0000000
--- a/examples/echo_service/client/private/src/echo_client_activator.c
+++ /dev/null
@@ -1,83 +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.
- */
-/*
- * echo_client_activator.c
- *
- *  \date       Sep 21, 2010
- *  \author            <a href="mailto:d...@celix.apache.org";>Apache Celix 
Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "bundle_activator.h"
-#include "service_tracker.h"
-
-#include "echo_server.h"
-#include "echo_client_private.h"
-
-struct echoActivator {
-       echo_client_pt client;
-       service_tracker_pt tracker;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt 
__attribute__((unused)) context, void **userData) {
-       struct echoActivator * act = malloc(sizeof(*act));
-       act->client = NULL;
-       act->tracker = NULL;
-       *userData = act;
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt 
context) {
-       struct echoActivator * act = (struct echoActivator *) userData;
-
-       service_tracker_pt tracker = NULL;
-       echo_client_pt client = NULL;
-
-       serviceTracker_create(context, ECHO_SERVICE_NAME, NULL, &tracker);
-
-       act->tracker = tracker;
-
-       client = echoClient_create(tracker);
-       act->client = client;
-
-       echoClient_start(act->client);
-       serviceTracker_open(act->tracker);
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt 
__attribute__((unused)) context) {
-       struct echoActivator * act = (struct echoActivator *) userData;
-       serviceTracker_close(act->tracker);
-       echoClient_stop(act->client);
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt  
__attribute__((unused)) context) {
-       struct echoActivator * act = (struct echoActivator *) userData;
-       serviceTracker_destroy(act->tracker);
-       echoClient_destroy(act->client);
-
-       free(act);
-
-       return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/echo_service/server/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/echo_service/server/CMakeLists.txt 
b/examples/echo_service/server/CMakeLists.txt
deleted file mode 100644
index fe2b268..0000000
--- a/examples/echo_service/server/CMakeLists.txt
+++ /dev/null
@@ -1,32 +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.
-
-add_bundle(echo_server
-       SYMBOLIC_NAME "apache_celix_examples_echo_server"
-       VERSION "0.0.1"
-       NAME "Apache Celix Echo Server"
-       SOURCES
-               private/src/echo_server_activator
-               private/src/echo_server
-
-               private/include/echo_server_private.h
-)
-
-include_directories("private/include")
-include_directories("public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-target_link_libraries(echo_server celix_framework)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/echo_service/server/private/include/echo_server_private.h
----------------------------------------------------------------------
diff --git a/examples/echo_service/server/private/include/echo_server_private.h 
b/examples/echo_service/server/private/include/echo_server_private.h
deleted file mode 100644
index c93035b..0000000
--- a/examples/echo_service/server/private/include/echo_server_private.h
+++ /dev/null
@@ -1,36 +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.
- */
-/*
- * echo_server_private.h
- *
- *  \date       Sep 21, 2010
- *  \author            <a href="mailto:d...@celix.apache.org";>Apache Celix 
Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-
-#ifndef ECHO_SERVER_PRIVATE_H_
-#define ECHO_SERVER_PRIVATE_H_
-
-#include "echo_server.h"
-
-echo_server_pt echoServer_create();
-void echoServer_echo(echo_server_pt server, char * text);
-void echoServer_destroy(echo_server_pt server);
-
-#endif /* ECHO_SERVER_PRIVATE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/echo_service/server/private/src/echo_server.c
----------------------------------------------------------------------
diff --git a/examples/echo_service/server/private/src/echo_server.c 
b/examples/echo_service/server/private/src/echo_server.c
deleted file mode 100644
index 045b7b7..0000000
--- a/examples/echo_service/server/private/src/echo_server.c
+++ /dev/null
@@ -1,49 +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.
- */
-/*
- * echo_server.c
- *
- *  \date       Sep 21, 2010
- *  \author            <a href="mailto:d...@celix.apache.org";>Apache Celix 
Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "echo_server_private.h"
-
-struct echoServer {
-       char * name;
-};
-
-echo_server_pt echoServer_create() {
-       echo_server_pt server = malloc(sizeof(*server));
-       server->name = "MacBook Pro";
-       return server;
-}
-
-void echoServer_echo(echo_server_pt server, char * text) {
-       printf("Server %s says %s\n", server->name, text);
-}
-
-void echoServer_destroy(echo_server_pt server) {
-       server->name = NULL;
-       free(server);
-       server = NULL;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/echo_service/server/private/src/echo_server_activator.c
----------------------------------------------------------------------
diff --git a/examples/echo_service/server/private/src/echo_server_activator.c 
b/examples/echo_service/server/private/src/echo_server_activator.c
deleted file mode 100644
index e7364f9..0000000
--- a/examples/echo_service/server/private/src/echo_server_activator.c
+++ /dev/null
@@ -1,78 +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.
- */
-/*
- * echo_server_activator.c
- *
- *  \date       Sep 21, 2010
- *  \author            <a href="mailto:d...@celix.apache.org";>Apache Celix 
Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "bundle_activator.h"
-#include "echo_server_private.h"
-
-struct echoActivator {
-       service_registration_pt reg;
-       echo_service_pt es;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void 
**userData) {
-       struct echoActivator * act = malloc(sizeof(*act));
-       act->reg = NULL;
-       *userData = act;
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt 
context) {
-       struct echoActivator * act = (struct echoActivator *) userData;
-
-       echo_service_pt es = malloc(sizeof(*es));
-       echo_server_pt server = echoServer_create();
-       es->server = server;
-       es->echo = echoServer_echo;
-
-       act->es = es;
-
-    bundleContext_registerService(context, ECHO_SERVICE_NAME, es, NULL, 
&act->reg);
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt 
context) {
-       struct echoActivator * act = (struct echoActivator *) userData;
-
-       serviceRegistration_unregister(act->reg);
-       act->reg = NULL;
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt 
context) {
-       struct echoActivator * act = (struct echoActivator *) userData;
-       act->es->echo = NULL;
-       echoServer_destroy(act->es->server);
-       act->es->server = NULL;
-       free(act->es);
-       act->es = NULL;
-       act->reg = NULL;
-       free(act);
-
-       return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/echo_service/server/public/include/echo_server.h
----------------------------------------------------------------------
diff --git a/examples/echo_service/server/public/include/echo_server.h 
b/examples/echo_service/server/public/include/echo_server.h
deleted file mode 100644
index 65acdf3..0000000
--- a/examples/echo_service/server/public/include/echo_server.h
+++ /dev/null
@@ -1,41 +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.
- */
-/*
- * echo_server.h
- *
- *  \date       Sep 21, 2010
- *  \author            <a href="mailto:d...@celix.apache.org";>Apache Celix 
Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-
-#ifndef ECHO_SERVER_H_
-#define ECHO_SERVER_H_
-
-#define ECHO_SERVICE_NAME "echo_server"
-
-typedef struct echoServer * echo_server_pt;
-
-struct echoService {
-       echo_server_pt server;
-       void (*echo)(echo_server_pt server, char * text);
-};
-
-typedef struct echoService * echo_service_pt;
-
-#endif /* ECHO_SERVER_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/embedding/private/src/main.c
----------------------------------------------------------------------
diff --git a/examples/embedding/private/src/main.c 
b/examples/embedding/private/src/main.c
index f785121..b77cb22 100644
--- a/examples/embedding/private/src/main.c
+++ b/examples/embedding/private/src/main.c
@@ -75,6 +75,7 @@ int main(void) {
 
                                                ((struct fooSrv*) 
fs2)->foo(((struct fooSrv*) fs2)->handle);
 
+                                               
bundleContext_ungetService(context, ref, NULL);
                                                
bundleContext_ungetServiceReference(context, ref);
                                                
serviceRegistration_unregister(reg);
                                        }

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/hello_world/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/hello_world/CMakeLists.txt 
b/examples/hello_world/CMakeLists.txt
index e3a5c59..cc2d436 100644
--- a/examples/hello_world/CMakeLists.txt
+++ b/examples/hello_world/CMakeLists.txt
@@ -16,7 +16,7 @@
 # under the License.
 
 if(NOT APPLE)
-#Importing and exporting libraries not (yet) work under OSX. 
+#Importing and exporting libraries not (yet) work under OSX.
 
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("public/include")

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/locking/CMakeLists.txt b/examples/locking/CMakeLists.txt
deleted file mode 100644
index fee34c6..0000000
--- a/examples/locking/CMakeLists.txt
+++ /dev/null
@@ -1,34 +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_directories(services)
-
-add_subdirectory(benchmark)
-add_subdirectory(math_provider)
-
-add_subdirectory(mutex_benchmark)
-#add_subdirectory(reference_benchmark)
-#add_subdirectory(start_stop_benchmark)
-#add_subdirectory(modified_bool_benchmark)
-
-
-#add_deploy("locking_example_reference" BUNDLES benchmark_runner 
reference_benchmark math_provider shell shell_tui log_service log_writer)
-add_deploy("locking_example_mutex" BUNDLES benchmark_runner mutex_benchmark 
math_provider shell shell_tui log_service log_writer)
-
-#add_deploy("locking_example_suspend" BUNDLES benchmark_runner 
start_stop_benchmark math_provider shell shell_tui log_service log_writer)
-#add_deploy("locking_example_rcu" BUNDLES benchmark_runner rcu_benchmark 
mutex_benchmark math_provider shell shell_tui log_service log_writer)
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/benchmark/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/locking/benchmark/CMakeLists.txt 
b/examples/locking/benchmark/CMakeLists.txt
deleted file mode 100644
index 7992c36..0000000
--- a/examples/locking/benchmark/CMakeLists.txt
+++ /dev/null
@@ -1,31 +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_directories(private/include)
-include_directories(public/include)
-include_directories(${PROJECT_SOURCE_DIR}/framework/public/include)
-include_directories(${PROJECT_SOURCE_DIR}/utils/public/include)
-include_directories(${PROJECT_SOURCE_DIR}/shell/public/include)
-
-add_bundle(benchmark_runner
-       VERSION 0.0.1
-       SOURCES
-               private/src/benchmark_runner_activator
-)
-
-target_link_libraries(benchmark_runner celix_framework)
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/benchmark/private/src/benchmark_runner_activator.c
----------------------------------------------------------------------
diff --git 
a/examples/locking/benchmark/private/src/benchmark_runner_activator.c 
b/examples/locking/benchmark/private/src/benchmark_runner_activator.c
deleted file mode 100644
index 09a5be3..0000000
--- a/examples/locking/benchmark/private/src/benchmark_runner_activator.c
+++ /dev/null
@@ -1,290 +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.
- */
-/*
- * benchmark_activator.c
- *
- *  \date       Feb 12, 2014
- *  \author            <a href="mailto:celix-...@incubator.apache.org";>Apache 
Celix Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-
-
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-#include <pthread.h>
-#include <string.h>
-#include <assert.h>
-
-#include "command.h"
-
-#include "bundle_activator.h"
-#include "service_tracker.h"
-
-#include "benchmark_service.h"
-#include "frequency_service.h"
-
-static celix_status_t benchmarkRunner_addingService(void * handle, 
service_reference_pt reference, void **service);
-static celix_status_t benchmarkRunner_addedService(void * handle, 
service_reference_pt reference, void * service);
-static celix_status_t benchmarkRunner_modifiedService(void * handle, 
service_reference_pt reference, void * service);
-static celix_status_t benchmarkRunner_removedService(void * handle, 
service_reference_pt reference, void * service);
-
-static void benchmarkRunner_runBenchmark(struct activator *activator, FILE 
*out);
-static void benchmarkRunner_printHeader(char *name, unsigned int nrOfSamples, 
FILE *out);
-static void benchmarkRunner_printResult(benchmark_result_t result, double 
updateFreq, unsigned long elapsedTime,
-                                       FILE *out);
-static void benchmarkRunner_printFooter(char *name, FILE *out);
-static celix_status_t benchmarkRunner_execute(void *handle, char * line, FILE 
*out, FILE *err);
-
-
-struct activator {
-       bundle_context_pt context;
-       service_tracker_customizer_pt customizer;
-       service_tracker_pt tracker;
-
-       pthread_mutex_t mutex;
-       benchmark_service_pt benchmark;
-       frequency_service_pt freqService;
-
-    command_service_pt command;
-    service_registration_pt reg;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void 
**userData) {
-       struct activator * activator = malloc(sizeof(*activator));
-       activator->context=context;
-       activator->customizer = NULL;
-       activator->tracker= NULL;
-       activator->benchmark = NULL;
-       activator->freqService = NULL;
-
-       *userData = activator;
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt 
context) {
-       celix_status_t status = CELIX_SUCCESS;
-       struct activator * activator = userData;
-
-       pthread_mutex_init(&activator->mutex, NULL);
-
-       serviceTrackerCustomizer_create(activator, 
benchmarkRunner_addingService, benchmarkRunner_addedService, 
benchmarkRunner_modifiedService, benchmarkRunner_removedService, 
&activator->customizer);
-
-       char filter[128];
-       sprintf(filter, "(|(%s=%s)(%s=%s))", "objectClass", 
BENCHMARK_SERVICE_NAME, "objectClass", FREQUENCY_SERVICE_NAME);
-       serviceTracker_createWithFilter(context, filter, activator->customizer, 
&activator->tracker);
-       serviceTracker_open(activator->tracker);
-
-
-    activator->reg = NULL;
-    activator->command = calloc(1, sizeof(*activator->command));
-    activator->command->handle = activator;
-    activator->command->executeCommand = benchmarkRunner_execute;
-    properties_pt props = properties_create();
-    properties_set(props, OSGI_SHELL_COMMAND_NAME, "benchmark");
-    properties_set(props, OSGI_SHELL_COMMAND_USAGE, "benchmark run");
-    properties_set(props, OSGI_SHELL_COMMAND_DESCRIPTION, "run the available 
benchmark");
-
-    bundleContext_registerService(context, (char 
*)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->command, props, &activator->reg);
-
-       return status;
-}
-
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context 
__attribute__((unused))) {
-       struct activator * activator = userData;
-
-       serviceTracker_close(activator->tracker);
-
-    serviceRegistration_unregister(activator->reg);
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt 
context __attribute__((unused))) {
-       struct activator * activator = userData;
-    free(activator);
-       return CELIX_SUCCESS;
-}
-
-static celix_status_t benchmarkRunner_addingService(void * handle, 
service_reference_pt reference, void **service) {
-       celix_status_t status;
-       struct activator * activator = handle;
-       status = bundleContext_getService(activator->context, reference, 
service);
-       return status;
-
-}
-static celix_status_t benchmarkRunner_addedService(void * handle, 
service_reference_pt reference, void * service) {
-       celix_status_t status = CELIX_SUCCESS;
-       struct activator * activator = handle;
-
-       service_registration_pt registration = NULL;
-       properties_pt properties = NULL;
-       const char* serviceName = NULL;
-       serviceReference_getServiceRegistration(reference, &registration);
-       serviceRegistration_getProperties(registration, &properties);
-       serviceName = properties_get(properties, "objectClass");
-       if (strcmp(serviceName, BENCHMARK_SERVICE_NAME) == 0) {
-               pthread_mutex_lock(&activator->mutex);
-               activator->benchmark = service;
-               pthread_mutex_unlock(&activator->mutex);
-       } else if (strcmp(serviceName, FREQUENCY_SERVICE_NAME) == 0 ) {
-               pthread_mutex_lock(&activator->mutex);
-               activator->freqService = service;
-               pthread_mutex_unlock(&activator->mutex);
-       }
-
-       return status;
-}
-static celix_status_t benchmarkRunner_modifiedService(void * handle 
__attribute__((unused)), service_reference_pt reference 
__attribute__((unused)), void * service __attribute__((unused))) {
-       celix_status_t status = CELIX_SUCCESS;
-       //ignore
-       return status;
-}
-
-static celix_status_t benchmarkRunner_removedService(void * handle, 
service_reference_pt reference, void * service) {
-       celix_status_t status = CELIX_SUCCESS;
-       struct activator * activator = handle;
-
-       service_registration_pt registration = NULL;
-               properties_pt properties = NULL;
-               const char* serviceName = NULL;
-               serviceReference_getServiceRegistration(reference, 
&registration);
-               serviceRegistration_getProperties(registration, &properties);
-               serviceName = properties_get(properties, "objectClass");
-               if (strcmp(serviceName, BENCHMARK_SERVICE_NAME) == 0) {
-                       pthread_mutex_lock(&activator->mutex);
-                       if (activator->benchmark == service) {
-                               activator->benchmark = NULL;
-                       }
-                       pthread_mutex_unlock(&activator->mutex);
-               } else if (strcmp(serviceName, FREQUENCY_SERVICE_NAME) == 0 ) {
-                       pthread_mutex_lock(&activator->mutex);
-                       if (activator->freqService == service) {
-                               activator->freqService = NULL;
-                       }
-                       pthread_mutex_unlock(&activator->mutex);
-               }
-
-       return status;
-}
-
-static void benchmarkRunner_runBenchmark(struct activator *activator, FILE 
*out) {
-       int k;
-       double updateFrequency;
-    double measuredFrequency = 0.0;
-       unsigned int measuredUpdateCounter, nrOfUpdateThreads;
-       int nrOfSamples;
-       benchmark_service_pt benchmarkServ;
-       char *name;
-       benchmark_result_t result;
-       struct timeval begin,end;
-       unsigned long elapsedTime;
-       double sampleFactor;
-
-
-       int nrOfThreadRuns = 12;
-       int threads[] = {1,2,3,4,5,6,7,8,16,32,64,128};
-
-       nrOfSamples = 100 * 1000;
-       updateFrequency = 1000;
-       nrOfUpdateThreads = 100;
-
-       benchmarkServ = activator->benchmark;
-       name = benchmarkServ->name(benchmarkServ->handler);
-       sampleFactor = benchmarkServ->getSampleFactor(benchmarkServ->handler);
-
-       pthread_mutex_lock(&activator->mutex);
-       if (activator->freqService != NULL) {
-               
activator->freqService->setFrequency(activator->freqService->handle, 
updateFrequency);
-               
activator->freqService->setNrOfThreads(activator->freqService->handle, 
nrOfUpdateThreads);
-               
activator->freqService->setBenchmarkName(activator->freqService->handle, name);
-       }
-
-       usleep(1000);
-    benchmarkRunner_printHeader(name, nrOfSamples * (int)sampleFactor, out);
-       for (k = 0 ; k < nrOfThreadRuns ; k +=1) {
-               if (activator->freqService != NULL) {
-                               
activator->freqService->resetCounter(activator->freqService->handle);
-
-               }
-               gettimeofday(&begin, NULL);
-               result = benchmarkServ->run(benchmarkServ->handler, threads[k], 
nrOfSamples * sampleFactor);
-               gettimeofday(&end, NULL);
-               elapsedTime = ((end.tv_sec - begin.tv_sec) * 1000000) + 
(end.tv_usec - begin.tv_usec);
-               if (activator->freqService != NULL) {
-                       measuredUpdateCounter = 
activator->freqService->getCounter(activator->freqService->handle);
-                       measuredFrequency = ((double)(measuredUpdateCounter) / 
elapsedTime * 1000000);
-               }
-        benchmarkRunner_printResult(result, measuredFrequency, elapsedTime, 
out);
-       }
-    benchmarkRunner_printFooter(name, out);
-
-       pthread_mutex_unlock(&activator->mutex);
-}
-
-static void benchmarkRunner_printHeader(char *name, unsigned int nrOfSamples, 
FILE *out) {
-               fprintf(out, 
"---%35s---------------------------------------------------------------------------------------\n",
 name);
-               fprintf(out, "-------samples: 
%10i---------------------------------------------------------------------------------------------------\n",
 nrOfSamples);
-}
-
-static void benchmarkRunner_printResult(benchmark_result_t result, double 
updateFreq, unsigned long elapsedTime,
-                                       FILE *out) {
-       fprintf(out, "| threads %5i | ", result.nrOfThreads);
-       fprintf(out, "average call time: %10.2f nanoseconds | ", 
result.averageCallTimeInNanoseconds);
-       fprintf(out, "frequency calls is %10.5f MHz | ", 
result.callFrequencyInMhz);
-       fprintf(out, "update freq ~ %8.2f Hz | ", updateFreq);
-       fprintf(out, "elapsed time is %8.5f seconds | ", ((double)elapsedTime) 
/ 1000000);
-    if (result.skips > 0 ) {
-        fprintf(out, "Warning skipped %i calls", result.skips);
-    }
-       fprintf(out, "\n");
-}
-
-static void benchmarkRunner_printFooter(char *name __attribute__((unused)), 
FILE *out) {
-       fprintf(out, 
"-----------------------------------------------------------------------------------------------------------------------------\n\n\n");
-}
-
-static celix_status_t benchmarkRunner_execute(void *handle, char * line, FILE 
*out, FILE *err) {
-    struct activator * activator = handle;
-    char *savePtr;
-    char *token = NULL;
-    token = strtok_r(line, " ", &savePtr); //command name
-    assert(strcmp(token, "benchmark") == 0);
-    token = strtok_r(NULL, " ", &savePtr); //sub command
-    if (strcmp("run", token) == 0) {
-        token = strtok_r(NULL, " ", &savePtr); //possible nr of time to run
-        int times = 1;
-        int i;
-        if (token != NULL) {
-            times = atoi(token);
-        }
-        for (i = 0; i < times; i += 1) {
-            fprintf(out, "running benchmark %i of %i\n", i+1, times);
-            benchmarkRunner_runBenchmark(activator, out);
-        }
-    } else {
-        fprintf(err, "Unknown subcommand '%s'\n", token);
-    }
-
-    return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/benchmark/public/include/benchmark.h
----------------------------------------------------------------------
diff --git a/examples/locking/benchmark/public/include/benchmark.h 
b/examples/locking/benchmark/public/include/benchmark.h
deleted file mode 100644
index 788444d..0000000
--- a/examples/locking/benchmark/public/include/benchmark.h
+++ /dev/null
@@ -1,41 +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.
- */
-
-#ifndef CONSUMER_H_
-#define CONSUMER_H_
-
-#include "celix_errno.h"
-
-#include "benchmark_result.h"
-#include "math_service.h"
-
-typedef struct benchmark *benchmark_pt; //ADT
-
-celix_status_t benchmark_create(benchmark_pt *benchmark);
-celix_status_t benchmark_destroy(benchmark_pt benchmark);
-
-benchmark_result_t benchmark_run(benchmark_pt benchmark, int nrOfThreads, int 
nrOfSamples);
-char * benchmark_getName(benchmark_pt benchmark);
-double benchmark_getSampleFactor(benchmark_pt benchmark);
-
-celix_status_t benchmark_addMathService(benchmark_pt benchmark, 
math_service_pt mathService);
-celix_status_t benchmark_removeMathService(benchmark_pt benchmark, 
math_service_pt mathService);
-
-
-#endif /* CONSUMER_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/benchmark/public/include/benchmark_result.h
----------------------------------------------------------------------
diff --git a/examples/locking/benchmark/public/include/benchmark_result.h 
b/examples/locking/benchmark/public/include/benchmark_result.h
deleted file mode 100644
index 636b9d1..0000000
--- a/examples/locking/benchmark/public/include/benchmark_result.h
+++ /dev/null
@@ -1,33 +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.
- */
-
-#ifndef BENCHMARK_RESULT_H_
-#define BENCHMARK_RESULT_H_
-
-typedef struct benchmark_result {
-               unsigned int nrOfThreads;
-               unsigned int nrOfsamples;
-               unsigned int requestedNrOfSamples;
-               unsigned int result;
-               unsigned int skips;
-               double averageCallTimeInNanoseconds;
-               double callFrequencyInMhz;
-} benchmark_result_t;
-
-#endif /* BENCHMARK_RESULT_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/benchmark/public/src/benchmark_activator.c
----------------------------------------------------------------------
diff --git a/examples/locking/benchmark/public/src/benchmark_activator.c 
b/examples/locking/benchmark/public/src/benchmark_activator.c
deleted file mode 100644
index ffd9621..0000000
--- a/examples/locking/benchmark/public/src/benchmark_activator.c
+++ /dev/null
@@ -1,119 +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.
- */
-/*
- * echo_server_activator.c
- *
- *  \date       Sep 21, 2010
- *  \author            <a href="mailto:celix-...@incubator.apache.org";>Apache 
Celix Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "service_registration.h"
-#include "service_tracker.h"
-
-#include "math_service.h"
-#include "benchmark.h"
-#include "benchmark_service.h"
-#include "frequency_service.h"
-
-static celix_status_t addedService(void * handle, service_reference_pt 
reference, void * service);
-static celix_status_t removedService(void * handle, service_reference_pt 
reference, void * service);
-
-struct activator {
-       bundle_context_pt context;
-       benchmark_pt benchmark;
-       benchmark_service_pt mathService;
-       service_tracker_customizer_pt customizer;
-       service_tracker_pt tracker;
-       service_registration_pt registration;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void 
**userData) {
-       struct activator * activator = malloc(sizeof(*activator));
-       activator->context=context;
-       activator->benchmark=NULL;
-       activator->mathService = NULL;
-       activator->customizer = NULL;
-       activator->tracker=NULL;
-       activator->registration = NULL;
-
-       *userData = activator;
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt 
context) {
-       celix_status_t status = CELIX_SUCCESS;
-       struct activator * activator = userData;
-
-       status = benchmark_create(&activator->benchmark);
-       serviceTrackerCustomizer_create(activator, NULL, addedService, NULL, 
removedService, &activator->customizer);
-
-       char filter[128];
-       sprintf(filter, "(&(objectClass=%s)(benchmark=%s))", MATH_SERVICE_NAME, 
benchmark_getName(activator->benchmark));
-
-       serviceTracker_createWithFilter(context, filter, activator->customizer, 
&activator->tracker);
-       serviceTracker_open(activator->tracker);
-
-       activator->mathService = malloc(sizeof(*activator->mathService));
-       activator->mathService->handler = (void *)activator->benchmark;
-       activator->mathService->name=(void *)benchmark_getName;
-       activator->mathService->getSampleFactor=(void 
*)benchmark_getSampleFactor;
-       activator->mathService->run=(void *)benchmark_run;
-
-       status = bundleContext_registerService(activator->context, 
BENCHMARK_SERVICE_NAME, activator->mathService, NULL, &activator->registration);
-
-       return status;
-}
-
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt 
context) {
-       struct activator * activator = userData;
-
-       serviceTracker_close(activator->tracker);
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt 
context) {
-       struct activator * activator = userData;
-
-       benchmark_destroy(activator->benchmark);
-       activator->benchmark=NULL;
-
-       return CELIX_SUCCESS;
-}
-
-static celix_status_t addedService(void * handle, service_reference_pt 
reference, void * service) {
-       celix_status_t status = CELIX_SUCCESS;
-       struct activator * activator = handle;
-       benchmark_addMathService(activator->benchmark, service);
-       return status;
-}
-
-static celix_status_t removedService(void * handle, service_reference_pt 
reference, void * service) {
-       celix_status_t status = CELIX_SUCCESS;
-       struct activator * activator = handle;
-       benchmark_removeMathService(activator->benchmark, service);
-       return status;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/consumer.c
----------------------------------------------------------------------
diff --git a/examples/locking/consumer.c b/examples/locking/consumer.c
deleted file mode 100644
index b73549e..0000000
--- a/examples/locking/consumer.c
+++ /dev/null
@@ -1,372 +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.
- */
-/*
- * consumer.c
- *
- *  \date       Feb 3, 2014
- *  \author            <a href="mailto:celix-...@incubator.apache.org";>Apache 
Celix Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-
-#include "consumer.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <pthread.h>
-
-#include <urcu.h>
-
-#include "math_service.h"
-#include "frequency_service.h"
-
-#define FREELIST_LENGTH 16
-
-typedef union service_counter service_counter_t;
-
-union service_counter {
-       volatile struct {
-               volatile u_int32_t counter; //TODO FIXME assuming little 
endian!!
-               volatile u_int32_t position;
-               math_service_pt math; // not accesible by raw
-       } info; //TODO rename data
-       volatile u_int64_t data; //TODO rename raw
-};
-
-struct consumer {
-       math_service_pt math;
-       frequency_service_pt frequencyService;
-       locking_type_t currentLockingType;
-       pthread_mutex_t mutex;
-       pthread_rwlock_t rw_lock;
-       service_counter_t *counters[FREELIST_LENGTH];
-       service_counter_t *current;
-};
-
-typedef struct run_info {
-       consumer_pt consumer;
-       volatile locking_type_t type;
-       int nrOfsamples;
-       int result;
-       uint skips;
-       uint updateCounter;
-       struct timeval begin;
-       struct timeval end;
-} run_info_t;
-
-static void * consumer_reference_run(run_info_t *info);
-static void * consumer_no_locking_run(run_info_t *info);
-static void * consumer_mutex_run(run_info_t *info);
-static void * consumer_rcu_run(run_info_t *info);
-static void * consumer_reference_counting_run(run_info_t *info);
-static void * consumer_rw_lock_run(run_info_t *info);
-
-static int consumer_reference_calc(int arg1, int arg2);
-
-celix_status_t consumer_create(consumer_pt *result) {
-       consumer_pt consumer = malloc(sizeof(*consumer));
-       consumer->math = NULL;
-       consumer->frequencyService = NULL;
-       consumer->currentLockingType=LOCKING_TYPE_NO_LOCKING;
-
-
-       service_counter_t *new = malloc(sizeof(service_counter_t));
-       new->info.position = 0;
-       new->info.counter = 0;
-       new->info.math = NULL;
-
-       int i;
-       for (i = 0; i < FREELIST_LENGTH; i+=1) {
-               consumer->counters[i] = NULL;
-       }
-       consumer->current = new;
-       consumer->counters[0] = new;
-
-       pthread_mutex_init(&consumer->mutex, NULL);
-       pthread_rwlock_init(&consumer->rw_lock, NULL);
-
-       rcu_init();
-
-       (*result) = consumer;
-       return CELIX_SUCCESS;
-}
-
-celix_status_t consumer_destroy(consumer_pt consumer) {
-       pthread_mutex_destroy(&consumer->mutex);
-       pthread_rwlock_destroy(&consumer->rw_lock);
-       free(consumer);
-       return CELIX_SUCCESS;
-}
-
-void consumer_setFrequencyService(consumer_pt consumer, frequency_service_pt 
freqServ) {
-       consumer->frequencyService=freqServ;
-}
-
-void consumer_runBenchmark(consumer_pt consumer, locking_type_t type, int 
nrOfThreads, int nrOfSamples) {
-       pthread_t threads[nrOfThreads];
-       run_info_t info[nrOfThreads];
-       int elapsedTime, skips, counter;
-       double callTime, callFreq, updateFreq;
-       int i;
-
-       consumer->currentLockingType=type;
-       usleep(1000);
-
-       //init
-       for (i = 0; i< nrOfThreads; i += 1) {
-               info[i].consumer = consumer;
-               info[i].nrOfsamples=nrOfSamples;
-               info[i].result = rand();
-               info[i].skips = 0;
-               info[i].updateCounter = 0;
-       }
-       elapsedTime = 0;
-       skips = 0;
-
-       //start threads
-       
info->consumer->frequencyService->resetCounter(info->consumer->frequencyService->handler);
-       for (i = 0; i < nrOfThreads; i += 1) {
-               if (type == LOCKING_TYPE_NO_LOCKING) {
-                       pthread_create(&threads[i], NULL, (void 
*)consumer_no_locking_run, &info[i]);
-               } else if (type == LOCKING_TYPE_MUTEX) {
-                       pthread_create(&threads[i], NULL, (void 
*)consumer_mutex_run, &info[i]);
-               } else if (type == LOCKING_TYPE_REFERENCE) {
-                       pthread_create(&threads[i], NULL, (void 
*)consumer_reference_run, &info[i]);
-               } else if (type == LOCKING_TYPE_RCU) {
-                       pthread_create(&threads[i], NULL, (void 
*)consumer_rcu_run, &info[i]);
-               } else if (type == LOCKING_TYPE_REFERENCE_COUNTER) {
-                       pthread_create(&threads[i], NULL, (void 
*)consumer_reference_counting_run, &info[i]);
-               } else if (type == LOCKING_TYPE_RW_LOCK) {
-                       pthread_create(&threads[i], NULL, (void 
*)consumer_rw_lock_run, &info[i]);
-               } else {
-                       printf ("unknown type\n");
-                       return;
-               }
-       }
-
-       //join and print result
-
-       for (i = 0; i < nrOfThreads; i +=1 ) {
-               pthread_join(threads[i], NULL);
-               elapsedTime += ((info[i].end.tv_sec - info[i].begin.tv_sec) * 
1000000) + (info[i].end.tv_usec - info[i].begin.tv_usec);
-               skips += info[i].skips;
-               counter += info[i].updateCounter;
-       }
-       counter = 
info->consumer->frequencyService->getCounter(info->consumer->frequencyService->handler);
-       callTime = ((double)elapsedTime * 1000) / (nrOfSamples * nrOfThreads);
-       callFreq = ((double)(nrOfSamples * nrOfThreads) / elapsedTime);
-       updateFreq = ((double)counter * 1000000) / elapsedTime;
-       printf("| threads %5i | ", nrOfThreads);
-       printf("average call time: % 10.2f nanoseconds | ", callTime);
-       printf("frequency calls is % 10.5f MHz | ", callFreq);
-       printf("update freq ~ % 8.2f Hz | ", updateFreq);
-       printf("\n");
-
-       if (skips > 0) {
-               printf("WARNING skips is %i\n", skips);
-       }
-}
-
-celix_status_t consumer_addMathService(consumer_pt consumer, math_service_pt 
mathService) {
-       if (consumer->currentLockingType == LOCKING_TYPE_MUTEX) {
-               pthread_mutex_lock(&consumer->mutex);
-               consumer->math = mathService;
-               pthread_mutex_unlock(&consumer->mutex);
-       } else if (consumer->currentLockingType == LOCKING_TYPE_RCU) {
-               consumer->math = mathService;
-               synchronize_rcu();
-       } else if (consumer->currentLockingType == LOCKING_TYPE_RW_LOCK) {
-               pthread_rwlock_wrlock(&consumer->rw_lock);
-               consumer->math = mathService;
-               pthread_rwlock_unlock(&consumer->rw_lock);
-       } else { //no locking
-               consumer->math = mathService;
-       }
-
-       //always update for reference counter
-//     service_counter_t *new = malloc(sizeof(service_counter_t));
-//     new->info.position = 0;
-//     new->info.counter = 0;
-//     new->info.math = mathService;
-//     int found = false;
-//     int pos;
-//     for (pos = 0; !found && pos < FREELIST_LENGTH; pos += 1) {
-//             found = 
__sync_bool_compare_and_swap(&(consumer->counters[pos]), NULL, new);
-//             if (found) {
-//                     new->info.position = pos;
-//                     break;
-//             }
-//     }
-//
-//     if (!found) {
-//             printf("Cannot find free spot!!!!, will use 0\n");
-//             consumer->counters[0] = new;
-//     }
-//
-//     int changed = false;
-//     service_counter_t *old;
-//     while (!changed) {
-//             old = consumer->current;
-//             changed = __sync_bool_compare_and_swap(&consumer->current, old, 
new);
-//     }
-//
-//     while (old->info.counter != 0) {usleep(10);}
-//     consumer->counters[old->info.position] = NULL;
-//     free(old);
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t consumer_removeMathService(consumer_pt consumer, 
math_service_pt mathService) {
-       if (consumer->currentLockingType == LOCKING_TYPE_NO_LOCKING) {
-               __sync_val_compare_and_swap(&consumer->math, mathService, NULL);
-       } else if (consumer->currentLockingType == LOCKING_TYPE_MUTEX) {
-               pthread_mutex_lock(&consumer->mutex);
-               if (consumer->math == mathService) {
-                       consumer->math = NULL;
-               }
-               pthread_mutex_unlock(&consumer->mutex);
-       } else if (consumer->currentLockingType == LOCKING_TYPE_RCU) {
-               uatomic_cmpxchg(&consumer->math, mathService, NULL);
-       } else if (consumer->currentLockingType == 
LOCKING_TYPE_REFERENCE_COUNTER) {
-               //TODO DONT KNOWN IGNORE FOR NOW
-       }
-       return CELIX_SUCCESS;
-}
-
-static void * consumer_reference_run(run_info_t *info) {
-       int i;
-
-       gettimeofday(&info->begin, NULL);
-       for (i = 0; i < info->nrOfsamples; i += 1) {
-               info->result = consumer_reference_calc(info->result, i);
-       }
-       gettimeofday(&info->end, NULL);
-       return NULL;
-}
-
-static void * consumer_no_locking_run(run_info_t *info) {
-       int i;
-
-       gettimeofday(&info->begin, NULL);
-       for (i = 0; i < info->nrOfsamples; i += 1) {
-               if (info->consumer->math != NULL) {
-                               info->result = 
info->consumer->math->calc(info->result, i);
-               } else {
-                               info->skips +=1; //should not happen
-               }
-       }
-       gettimeofday(&info->end, NULL);
-       return NULL;
-}
-
-static void * consumer_mutex_run(run_info_t *info) {
-       int i;
-
-       gettimeofday(&info->begin, NULL);
-       for (i = 0; i < info->nrOfsamples; i += 1) {
-               pthread_mutex_lock(&info->consumer->mutex);
-               if (info->consumer->math != NULL) {
-                       info->result = info->consumer->math->calc(info->result, 
i);
-               } else {
-                       info->skips += 1; //should not happen
-               }
-               pthread_mutex_unlock(&info->consumer->mutex);
-       }
-       gettimeofday(&info->end, NULL);
-       return NULL;
-}
-
-static void * consumer_rw_lock_run(run_info_t *info) {
-       int i;
-       consumer_pt cons = info->consumer;
-       int result = info->result;
-       pthread_rwlock_t *lock = &cons->rw_lock;
-       int nrOfsamples = info->nrOfsamples;
-
-       gettimeofday(&info->begin, NULL);
-       for (i = 0; i < nrOfsamples; i += 1) {
-               pthread_rwlock_rdlock(lock);
-               if (cons->math != NULL) {
-                       result = cons->math->calc(result, i);
-               } else {
-                       info->skips += 1; //should not happen
-               }
-               pthread_rwlock_unlock(lock);
-       }
-       gettimeofday(&info->end, NULL);
-       info->result = result;
-       return NULL;
-}
-
-static void * consumer_rcu_run(run_info_t *info) {
-       rcu_register_thread();
-       int i;
-       math_service_pt service;
-
-       gettimeofday(&info->begin, NULL);
-       for (i = 0; i < info->nrOfsamples; i += 1) {
-               rcu_read_lock();
-               if (info->consumer->math != NULL) {
-                       info->result = info->consumer->math->calc(info->result, 
i);
-               } else {
-                       info->skips +=1; //should not happen
-               }
-               rcu_read_unlock();
-       }
-       gettimeofday(&info->end, NULL);
-       rcu_unregister_thread();
-       return NULL;
-}
-
-static void * consumer_reference_counting_run(run_info_t *info) {
-       int i;
-       service_counter_t posAndCount;
-
-       gettimeofday(&info->begin, NULL);
-       for (i = 0; i < info->nrOfsamples; i += 1) {
-               posAndCount.data = __sync_add_and_fetch((u_int64_t 
*)&info->consumer->current->data, 1);
-               volatile service_counter_t *serv = (volatile void 
*)info->consumer->counters[posAndCount.info.position];
-               if (serv->info.math != NULL) {
-                       info->result = serv->info.math->calc(info->result, i);
-               } else {
-                       info->skips += 1;
-               }
-               __sync_sub_and_fetch((u_int64_t *)&serv->data, -1);
-
-               //not service_counter will not be deleted...but can we still 
find it??? is info->consumer->serviceCounter still te same?
-               //change write to swap compare and then only changing the 
pointer is the counter is null?? not possible.. can compare counter , but not 
change pointer
-
-               //IDEA create a list with service_counter based on a id 
(number) this number is 32bit long and put a counter + id in a 64bit value.
-               //use this value to atomic increment and return value and use 
the id to retrieve the actual pointer. the value can be stored in the heap.
-               //A list with id is used to retrieve a pointer to the service. 
If the value is null the slot is available this can be check with
-               //compare_and_swap while looping through the list. The list can 
be extended when the end is reached and then a next list pointer can
-               //be used. This can also be a linked list and the limitation is 
the max 32bit uint value (of 16bits for 32bit platforms).
-       }
-
-       gettimeofday(&info->end, NULL);
-       return NULL;
-}
-
-//NOTE: copy implementation of the math_service->calc function, for reference.
-static int consumer_reference_calc(int arg1, int arg2) {
-       return  arg1 * arg2 + arg2;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/math_provider/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/locking/math_provider/CMakeLists.txt 
b/examples/locking/math_provider/CMakeLists.txt
deleted file mode 100644
index de83d7e..0000000
--- a/examples/locking/math_provider/CMakeLists.txt
+++ /dev/null
@@ -1,32 +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_directories(public/include)
-include_directories(../benchmark/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-include_directories(private/include)
-
-add_bundle(math_provider
-       VERSION 0.0.1
-       SOURCES
-               private/src/provider_activator
-               private/src/math_component
-)
-
-target_link_libraries(math_provider celix_framework)

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/math_provider/private/include/math_component.h
----------------------------------------------------------------------
diff --git a/examples/locking/math_provider/private/include/math_component.h 
b/examples/locking/math_provider/private/include/math_component.h
deleted file mode 100644
index b2b1510..0000000
--- a/examples/locking/math_provider/private/include/math_component.h
+++ /dev/null
@@ -1,32 +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.
- */
-#ifndef MATH_COMPONENT_H_
-#define MATH_COMPONENT_H_
-
-#include "celix_errno.h"
-
-typedef struct math_component *math_component_pt;
-
-celix_status_t mathComponent_create(math_component_pt *math);
-celix_status_t mathComponent_destroy(math_component_pt math);
-
-int mathComponent_calc(math_component_pt math, int arg1, int arg2);
-
-
-#endif /* MATH_COMPONENT_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/math_provider/private/src/math_component.c
----------------------------------------------------------------------
diff --git a/examples/locking/math_provider/private/src/math_component.c 
b/examples/locking/math_provider/private/src/math_component.c
deleted file mode 100644
index bc83c8e..0000000
--- a/examples/locking/math_provider/private/src/math_component.c
+++ /dev/null
@@ -1,41 +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 <stdlib.h>
-#include "math_component.h"
-
-struct math_component {
-       //emtpy
-};
-
-celix_status_t mathComponent_create(math_component_pt *math) {
-       (*math) = calloc(1, sizeof(struct math_component));
-       return CELIX_SUCCESS;
-}
-
-celix_status_t mathComponent_destroy(math_component_pt math) {
-       free(math);
-       return CELIX_SUCCESS;
-}
-
-int mathComponent_calc(math_component_pt math __attribute__((unused)), int 
arg1, int arg2) {
-       return arg1 * arg2 + arg2;
-}
-
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/math_provider/private/src/provider_activator.c
----------------------------------------------------------------------
diff --git a/examples/locking/math_provider/private/src/provider_activator.c 
b/examples/locking/math_provider/private/src/provider_activator.c
deleted file mode 100644
index 58069d0..0000000
--- a/examples/locking/math_provider/private/src/provider_activator.c
+++ /dev/null
@@ -1,228 +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.
- */
-/*
- * echo_server_activator.c
- *
- *  \date       Sep 21, 2010
- *  \author            <a href="mailto:celix-...@incubator.apache.org";>Apache 
Celix Project Team</a>
- *  \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <pthread.h>
-#include <signal.h>
-
-
-
-#include "bundle_activator.h"
-
-#include "math_service.h"
-#include "frequency_service.h"
-#include "math_component.h"
-
-typedef struct activator {
-       bundle_context_pt context;
-       bool isRunning;
-
-       frequency_service_pt freqService;
-       service_registration_pt freqRegistration;
-
-       math_component_pt math;
-       math_service_pt mathService;
-       char *benchmarkName;
-       service_registration_pt registration;
-
-       double updateFrequency;
-       unsigned int nrOfThreads;
-       pthread_t *threads;
-
-
-       unsigned int counter;
-} activator_t;
-
-static int calc(int arg1, int arg2)  __attribute__((unused));
-static void* run(void *data);
-static void setFrequency(activator_t *activator, double freq);
-static void setNrOfThreads(activator_t *activator, unsigned int nrOfThreads);
-static void resetCounter(activator_t *activator);
-static void stopThreads(activator_t *activator);
-static void startThreads(activator_t *activator, unsigned int nrOfThreads);
-static unsigned int getCounter(activator_t *activator);
-static void setBenchmarkName(activator_t *activator, char *benchmark);
-static math_service_pt registerMath(activator_t *activator, 
service_registration_pt *reg);
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void 
**userData) {
-       activator_t * activator = malloc(sizeof(*activator));
-       activator->context = context;
-       activator->benchmarkName = NULL;
-       activator->freqService  = NULL;
-       activator->registration = NULL;
-       activator->freqRegistration  = NULL;
-       activator->updateFrequency = 0;
-       activator->nrOfThreads = 0;
-       activator->math = NULL;
-
-       mathComponent_create(&activator->math);
-
-       *userData = activator;
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt 
context __attribute__((unused))) {
-       celix_status_t status = CELIX_SUCCESS;
-       struct activator * activator = userData;
-
-    activator->isRunning = true;
-       activator->mathService = malloc(sizeof(*activator->mathService));
-       activator->mathService->handle = activator->math;
-       activator->mathService->calc = (void *)mathComponent_calc;
-       bundleContext_registerService(activator->context, MATH_SERVICE_NAME, 
activator->mathService, NULL, &activator->registration);
-
-       activator->freqService = malloc(sizeof(*activator->freqService));
-       activator->freqService->handle = (void *)activator;
-       activator->freqService->setFrequency = (void *)setFrequency;
-       activator->freqService->resetCounter = (void *)resetCounter;
-       activator->freqService->getCounter = (void *)getCounter;
-       activator->freqService->setBenchmarkName = (void *)setBenchmarkName;
-       activator->freqService->setNrOfThreads = (void *)setNrOfThreads;
-       bundleContext_registerService(activator->context, 
FREQUENCY_SERVICE_NAME, activator->freqService, NULL, 
&activator->freqRegistration);
-
-       startThreads(activator, activator->nrOfThreads);
-
-       return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context 
__attribute__((unused))) {
-       struct activator * activator = userData;
-
-       printf("Stopping service registration thread\n");
-       stopThreads(activator);
-
-       //TODO deregister service & freqService
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt 
context __attribute__((unused))) {
-       struct echoActivator * activator = userData;
-
-       //TODO free service & freqService struct
-
-       free(activator);
-
-       return CELIX_SUCCESS;
-}
-
-static int calc(int arg1, int arg2) {
-       return  arg1 * arg2 + arg2;
-}
-
-static void stopThreads(activator_t *activator) {
-       //cancel and join threads
-    activator->isRunning = false;
-       if (activator->threads != NULL) {
-               for (int i = 0 ; i < activator->nrOfThreads ; i += 1) {
-            pthread_kill(activator->threads[i], SIGUSR1);
-                       pthread_join(activator->threads[i], NULL);
-               }
-       }
-}
-
-static void startThreads(activator_t *activator, unsigned int nrOfThreads) {
-    activator->isRunning = true;
-       activator->threads = malloc(sizeof(pthread_t) * nrOfThreads);
-       for (int i = 0 ; i < nrOfThreads ; i += 1) {
-               pthread_create(&activator->threads[i], NULL, (void *)run, 
activator);
-       }
-       activator->nrOfThreads = nrOfThreads;
-}
-
-static void* run(void *data) {
-       activator_t *activator = data;
-
-       service_registration_pt currentReg = NULL;
-       service_registration_pt prevReg = NULL;
-       math_service_pt current = NULL;
-       math_service_pt prev = NULL;
-
-       while (activator->isRunning) {
-               unsigned int delayInMicroseconds =  activator->updateFrequency 
== 0 ? 0 : (1000 * 1000) / activator->updateFrequency;
-               if (delayInMicroseconds > 0) {
-                       prevReg = currentReg;
-                       prev = current;
-
-                       currentReg = NULL;
-                       current = registerMath(activator, &currentReg);
-
-                       if (prevReg != NULL) {
-                               serviceRegistration_unregister(prevReg);
-                               free(prev);
-                       }
-               }
-               usleep(delayInMicroseconds > 0 ? delayInMicroseconds : 1000000);
-       }
-
-    return NULL;
-}
-
-static math_service_pt registerMath(activator_t *activator, 
service_registration_pt *reg) {
-       math_service_pt serv = NULL;
-       serv = malloc(sizeof(*activator->mathService));
-       serv->handle = activator->math;
-       serv->calc = (void *)mathComponent_calc;
-       properties_pt props = properties_create();
-       if (activator->benchmarkName != NULL) { //TODO FIXME race condition
-               properties_set(props, "benchmark", activator->benchmarkName);
-       }
-       bundleContext_registerService(activator->context, MATH_SERVICE_NAME,
-                       serv, props, reg);
-       activator->counter += 1;
-       return serv;
-}
-
-static void setBenchmarkName(activator_t *activator, char *benchmark) {
-       char *old = activator->benchmarkName;
-       activator->benchmarkName = strdup(benchmark);
-       free(old);
-       if (activator->updateFrequency == 0) {
-               service_registration_pt reg = NULL;
-               registerMath(activator, &reg); //TODO service will not be 
cleaned up !
-       }
-}
-
-static void setFrequency(activator_t *activator, double freq) {
-       printf("Setting frequency to %f\n", freq);
-       activator->updateFrequency = freq;
-}
-
-static void setNrOfThreads(activator_t *activator, unsigned int nrOfThreads) {
-    printf("Setting nr of update Threads to %d\n", nrOfThreads);
-    stopThreads(activator);
-       startThreads(activator, nrOfThreads);
-}
-
-static void resetCounter(activator_t *activator) {
-       activator->counter = 0;
-}
-
-static unsigned int getCounter(activator_t *activator) {
-       return activator->counter;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/modified_bool_benchmark/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/locking/modified_bool_benchmark/CMakeLists.txt 
b/examples/locking/modified_bool_benchmark/CMakeLists.txt
deleted file mode 100644
index 4f3d002..0000000
--- a/examples/locking/modified_bool_benchmark/CMakeLists.txt
+++ /dev/null
@@ -1,29 +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.
-
-add_bundle(modified_bool_benchmark SOURCES
-       ../benchmark/public/src/benchmark_activator
-       private/src/modified_bool_benchmark 
-)
-
-include_directories(public/include)
-include_directories(../benchmark/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-target_link_libraries(modified_bool_benchmark celix_framework)
-

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/modified_bool_benchmark/private/src/modified_bool_benchmark.c
----------------------------------------------------------------------
diff --git 
a/examples/locking/modified_bool_benchmark/private/src/modified_bool_benchmark.c
 
b/examples/locking/modified_bool_benchmark/private/src/modified_bool_benchmark.c
deleted file mode 100644
index cdf8815..0000000
--- 
a/examples/locking/modified_bool_benchmark/private/src/modified_bool_benchmark.c
+++ /dev/null
@@ -1,180 +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 <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <pthread.h>
-
-#include "array_list.h"
-
-#include "benchmark.h"
-#include "math_service.h"
-
-static const char * const BENCHMARK_NAME = "MODIFIED_BIT";
-static const double SAMPLE_FACTOR = 1;
-static const useconds_t SLEEP_TIME = 10;
-
-typedef struct thread_info {
-       benchmark_pt benchmark;
-       unsigned int result;
-       struct timeval begin;
-       struct timeval end;
-       int skips;
-       bool isModified;
-    bool isUpdated;
-} thread_info_t;
-
-struct benchmark {
-    pthread_mutex_t mutex;
-    math_service_pt math;
-    int nrOfSamples;
-    int nrOfThreads;
-    thread_info_t *threads;
-};
-
-static void benchmark_thread(thread_info_t *info);
-
-celix_status_t benchmark_create(benchmark_pt *benchmark) {
-       (*benchmark) = malloc(sizeof(struct benchmark));
-       (*benchmark)->math = NULL;
-       pthread_mutex_init(&(*benchmark)->mutex, NULL);
-    return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_destroy(benchmark_pt benchmark) {
-    //free threads array
-       free(benchmark);
-    return CELIX_SUCCESS;
-}
-
-benchmark_result_t benchmark_run(benchmark_pt benchmark, int nrOfThreads, int 
nrOfSamples) {
-       int i;
-       pthread_t threads[nrOfThreads];
-       thread_info_t infos[nrOfThreads];
-       benchmark_result_t result;
-       unsigned long elapsedTime = 0;
-
-       benchmark->threads = infos;
-       benchmark->nrOfSamples = nrOfSamples;
-    benchmark->nrOfThreads = nrOfThreads;
-
-       result.skips =0;
-    pthread_mutex_lock(&benchmark->mutex);
-       for (i = 0 ; i < nrOfThreads ; i += 1) {
-               infos[i].benchmark = benchmark;
-               infos[i].skips = 0;
-               infos[i].result = rand();
-               infos[i].isUpdated = false;
-               infos[i].isModified = false;
-               pthread_create(&threads[i], NULL, (void *)benchmark_thread,  
&infos[i]);
-       }
-    pthread_mutex_unlock(&benchmark->mutex);
-
-       for (i = 0; i < nrOfThreads ; i += 1) {
-               pthread_join(threads[i], NULL);
-               elapsedTime += ((infos[i].end.tv_sec - infos[i].begin.tv_sec) * 
1000000) + (infos[i].end.tv_usec - infos[i].begin.tv_usec);
-               result.skips += infos[i].skips;
-       }
-
-       result.averageCallTimeInNanoseconds = ((double)elapsedTime * 1000) / 
(nrOfSamples * nrOfThreads);
-       result.callFrequencyInMhz = ((double)(nrOfSamples * nrOfThreads) / 
elapsedTime);
-       result.nrOfThreads = nrOfThreads;
-       result.nrOfsamples = nrOfSamples;
-
-       return result;
-}
-
-static void benchmark_thread(thread_info_t *info) {
-       int i = 0;
-
-    math_service_pt local = info->benchmark->math;
-       int nrOfSamples = info->benchmark->nrOfSamples;
-       
-       gettimeofday(&info->begin, NULL);
-       while (i < nrOfSamples) {
-               if (!info->isModified) {
-            if (local != NULL) {
-                info->result = local->calc(local->handle, info->result, i);
-            } else {
-                info->skips += 1; //should not happen
-            }
-            i += 1;
-        } else {
-                       local = info->benchmark->math;
-                       info->isModified = false;
-               }
-       }
-       gettimeofday(&info->end, NULL);
-
-}
-
-char * benchmark_getName(benchmark_pt benchmark) {
-       return (char *)BENCHMARK_NAME;
-}
-
-celix_status_t benchmark_addMathService(benchmark_pt benchmark, 
math_service_pt mathService) {
-       int i;
-
-       pthread_mutex_lock(&benchmark->mutex);
-       benchmark->math = mathService;
-       pthread_mutex_unlock(&benchmark->mutex);
-
-       //inform threads to update servicd
-       for (i = 0 ; i < benchmark->nrOfSamples ; i += 1) {
-               benchmark->threads[i].isModified = true;
-       }       
-
-       //Wait till al thread are not in a modified state, e.g. update to date 
mathService and not using the old service
-       for (i = 0; i < benchmark->nrOfThreads ; i += 1) {
-               if (benchmark->threads[i].isModified) {
-                       usleep(SLEEP_TIME);
-               }
-       }
-
-       return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_removeMathService(benchmark_pt benchmark, 
math_service_pt mathService) {
-       pthread_mutex_lock(&benchmark->mutex);
-       if (benchmark->math == mathService) {
-               benchmark->math = NULL;
-       } 
-       pthread_mutex_unlock(&benchmark->mutex);
-
-       //inform threads to update servicd
-    int i;
-       for (i = 0 ; i < benchmark->nrOfThreads ; i += 1) {
-               benchmark->threads[i].isModified = true;
-       }       
-
-       //Wait till al thread are not in a modified state, e.g. update to date 
mathService and not using the old service
-       for (i = 0; i < benchmark->nrOfThreads ; i += 1) {
-               if (benchmark->threads[i].isModified) {
-                       usleep(SLEEP_TIME);
-               }
-       }
-
-       
-       return CELIX_SUCCESS;
-}
-
-double benchmark_getSampleFactor(benchmark_pt benchmark) {
-       return SAMPLE_FACTOR;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/505f6a84/examples/locking/mutex_benchmark/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/locking/mutex_benchmark/CMakeLists.txt 
b/examples/locking/mutex_benchmark/CMakeLists.txt
deleted file mode 100644
index 71ab71d..0000000
--- a/examples/locking/mutex_benchmark/CMakeLists.txt
+++ /dev/null
@@ -1,32 +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_directories(public/include)
-include_directories(../benchmark/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-
-add_bundle(mutex_benchmark
-       VERSION 0.0.1
-       SOURCES
-               ../benchmark/public/src/benchmark_activator
-               private/src/mutex_benchmark
-)
-
-target_link_libraries(mutex_benchmark celix_framework)
-

Reply via email to