Author: abroekhuis
Date: Tue Nov 27 14:17:30 2012
New Revision: 1414201

URL: http://svn.apache.org/viewvc?rev=1414201&view=rev
Log:
CELIX-42: Updated the examples to compile with Visual Studio

Modified:
    
incubator/celix/trunk/examples/echo_service/client/private/include/echo_client_private.h
    incubator/celix/trunk/examples/echo_service/client/private/src/echo_client.c
    
incubator/celix/trunk/examples/echo_service/client/private/src/echo_client_activator.c
    incubator/celix/trunk/examples/mongoose/CMakeLists.txt
    incubator/celix/trunk/examples/mongoose/private/src/activator.c
    
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
    
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt
    
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
    incubator/celix/trunk/examples/whiteboard/publisherA/private/src/activator.c
    incubator/celix/trunk/examples/whiteboard/publisherB/private/src/activator.c
    
incubator/celix/trunk/examples/whiteboard/publisherService/private/include/publisher_private.h
    incubator/celix/trunk/examples/whiteboard/tracker/private/src/activator.c
    
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/include/tracker.h
    
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
    
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/src/tracker.c
    incubator/celix/trunk/framework/public/include/celix_errno.h

Modified: 
incubator/celix/trunk/examples/echo_service/client/private/include/echo_client_private.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/echo_service/client/private/include/echo_client_private.h?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/echo_service/client/private/include/echo_client_private.h
 (original)
+++ 
incubator/celix/trunk/examples/echo_service/client/private/include/echo_client_private.h
 Tue Nov 27 14:17:30 2012
@@ -27,19 +27,19 @@
 #ifndef ECHO_CLIENT_PRIVATE_H_
 #define ECHO_CLIENT_PRIVATE_H_
 
-#include <stdbool.h>
-#include <pthread.h>
+#include <celixbool.h>
 
 struct echoClient {
        service_tracker_t tracker;
        bool running;
+       apr_pool_t *pool;
 
-       pthread_t sender;
+       apr_thread_t *sender;
 };
 
 typedef struct echoClient * ECHO_CLIENT;
 
-ECHO_CLIENT echoClient_create(service_tracker_t context);
+ECHO_CLIENT echoClient_create(service_tracker_t context, apr_pool_t *pool);
 
 void echoClient_start(ECHO_CLIENT client);
 void echoClient_stop(ECHO_CLIENT client);

Modified: 
incubator/celix/trunk/examples/echo_service/client/private/src/echo_client.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/echo_service/client/private/src/echo_client.c?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/echo_service/client/private/src/echo_client.c 
(original)
+++ 
incubator/celix/trunk/examples/echo_service/client/private/src/echo_client.c 
Tue Nov 27 14:17:30 2012
@@ -24,43 +24,43 @@
  *  \copyright Apache License, Version 2.0
  */
 #include <stdlib.h>
-#include <unistd.h>
 
 #include "service_tracker.h"
 
 #include "echo_client_private.h"
 #include "echo_server.h"
 
-void * trk_send(void * handle) {
+static void *APR_THREAD_FUNC trk_send(apr_thread_t *thd, void *handle) {
        ECHO_CLIENT client = (ECHO_CLIENT) handle;
        while (client->running) {
                ECHO_SERVICE service = (ECHO_SERVICE) 
serviceTracker_getService(client->tracker);
                if (service != NULL) {
                        service->echo(service->server, "hi");
                }
-               sleep(1);
+               apr_sleep(1);
        }
-       pthread_exit(NULL);
+       apr_thread_exit(thd, APR_SUCCESS);
        return NULL;
 }
 
-ECHO_CLIENT echoClient_create(service_tracker_t echoServiceTracker) {
+ECHO_CLIENT echoClient_create(service_tracker_t echoServiceTracker, apr_pool_t 
*pool) {
        ECHO_CLIENT client = malloc(sizeof(*client));
 
        client->tracker = echoServiceTracker;
        client->running = false;
+       client->pool = pool;
 
        return client;
 }
 
 void echoClient_start(ECHO_CLIENT client) {
        client->running = true;
-       pthread_create(&client->sender, NULL, trk_send, client);
+       apr_thread_create(&client->sender, NULL, trk_send, client, 
client->pool);
 }
 
 void echoClient_stop(ECHO_CLIENT client) {
        client->running = false;
-       pthread_join(client->sender, NULL);
+       apr_thread_join(APR_SUCCESS, client->sender);
 }
 
 void echoClient_destroy(ECHO_CLIENT client) {

Modified: 
incubator/celix/trunk/examples/echo_service/client/private/src/echo_client_activator.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/echo_service/client/private/src/echo_client_activator.c?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/echo_service/client/private/src/echo_client_activator.c
 (original)
+++ 
incubator/celix/trunk/examples/echo_service/client/private/src/echo_client_activator.c
 Tue Nov 27 14:17:30 2012
@@ -52,12 +52,13 @@ celix_status_t bundleActivator_start(voi
 
        apr_pool_t *pool = NULL;
        service_tracker_t tracker = NULL;
+       ECHO_CLIENT client = NULL;
 
        bundleContext_getMemoryPool(context, &pool);
        serviceTracker_create(pool, context, ECHO_SERVICE_NAME, NULL, &tracker);
        act->tracker = tracker;
 
-       ECHO_CLIENT client = echoClient_create(tracker);
+       client = echoClient_create(tracker, pool);
        act->client = client;
 
        echoClient_start(act->client);

Modified: incubator/celix/trunk/examples/mongoose/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/mongoose/CMakeLists.txt?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- incubator/celix/trunk/examples/mongoose/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/mongoose/CMakeLists.txt Tue Nov 27 14:17:30 
2012
@@ -21,6 +21,6 @@ SET_TARGET_PROPERTIES(mongoose PROPERTIE
 include_directories("private/include")
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 bundle(celix.mongoose SOURCES private/src/activator DIRECTORIES root)
-target_link_libraries(celix.mongoose celix_framework mongoose)
+target_link_libraries(celix.mongoose celix_framework mongoose wsock32)
 
 

Modified: incubator/celix/trunk/examples/mongoose/private/src/activator.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/mongoose/private/src/activator.c?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- incubator/celix/trunk/examples/mongoose/private/src/activator.c (original)
+++ incubator/celix/trunk/examples/mongoose/private/src/activator.c Tue Nov 27 
14:17:30 2012
@@ -52,14 +52,14 @@ celix_status_t bundleActivator_start(voi
            apr_pool_t *pool;
            celix_status_t status = bundleContext_getMemoryPool(context, &pool);
            if (status == CELIX_SUCCESS) {
-            char *entry = NULL;
-            bundle_getEntry(bundle, "root", pool, &entry);
-
-            const char *options[] = {
+                       char *entry = NULL;
+                       const char *options[] = {
                 "document_root", entry,
                 "listening_ports", "8081",
                 NULL
             };
+            bundle_getEntry(bundle, "root", pool, &entry);
+
             data->ctx = mg_start(NULL, options);
 
             printf("Mongoose started on: %s\n", mg_get_option(data->ctx, 
"listening_ports"));

Modified: 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
 (original)
+++ 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
 Tue Nov 27 14:17:30 2012
@@ -25,7 +25,6 @@
  */
 #include <stdlib.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <apr_general.h>
 
 #include "bundle_activator.h"
@@ -89,6 +88,7 @@ celix_status_t bundleActivator_start(voi
                status = CELIX_ENOMEM;
        } else {
                char filter[30];
+               ARRAY_LIST logServices = NULL;
                sprintf(filter, "(objectClass=%s)", LOG_SERVICE_NAME);
 
                listener->handle = activator;
@@ -98,7 +98,6 @@ celix_status_t bundleActivator_start(voi
                        activator->listener = listener;
                }
 
-               ARRAY_LIST logServices = NULL;
                status = bundleContext_getServiceReferences(context, NULL, 
filter, &logServices);
                if (status == CELIX_SUCCESS) {
                        int i;
@@ -184,7 +183,7 @@ static void *APR_THREAD_FUNC listenerExa
                } else {
                        listenerExample_alternativeLog(activator, "No 
LogService available. Printing to standard out.");
                }
-               sleep(5);
+               apr_sleep(5);
        }
 
        return NULL;

Modified: 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt
 (original)
+++ 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt
 Tue Nov 27 14:17:30 2012
@@ -18,4 +18,4 @@
 bundle(chapter04-correct-lookup SOURCES private/src/activator)
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(chapter04-correct-lookup celix_framework pthread)
+target_link_libraries(chapter04-correct-lookup celix_framework)

Modified: 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
 (original)
+++ 
incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
 Tue Nov 27 14:17:30 2012
@@ -26,11 +26,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <apr_general.h>
-#include <unistd.h>
 
 #include "bundle_activator.h"
 #include "bundle_context.h"
-#include "pthread.h"
 #include "log_service.h"
 #include "bundle.h"
 
@@ -44,7 +42,7 @@ struct threadData {
 
 typedef struct threadData *THREAD_DATA;
 
-static pthread_t m_logTestThread;
+static apr_thread_t *m_logTestThread;
 
 
 
//*******************************************************************************
@@ -91,12 +89,14 @@ celix_status_t bundleActivator_destroy(v
 //  The rest of this is just support code, not meant to show any particular 
best practices
 
//------------------------------------------------------------------------------------------
 
-// Test LogService by periodically sending a message
-void *LogServiceTest (void *argument){
+// Test LogService by periodically sending a message
+void *APR_THREAD_FUNC LogServiceTest(apr_thread_t *thd, void *argument) {
        celix_status_t status = CELIX_SUCCESS;
        THREAD_DATA data = (THREAD_DATA) argument;
        bundle_context_t m_context = ((THREAD_DATA) argument)->m_context;
-       while (pthread_self() == m_logTestThread) {
+       apr_os_thread_t *logThread = NULL;
+       apr_os_thread_get(&logThread, m_logTestThread);
+       while (apr_os_thread_current() == logThread) {
                SERVICE_REFERENCE logServiceRef = NULL;
                // lookup the current "best" LogService each time, just before 
we need to use it
                status = bundleContext_getServiceReference(m_context, (char *) 
LOG_SERVICE_NAME, &logServiceRef);
@@ -121,22 +121,25 @@ void *LogServiceTest (void *argument){
 }
 
 void startTestThread(THREAD_DATA data) {
+       apr_pool_t *pool;
+       int rc;
        // start separate worker thread to run the actual tests, managed by the 
bundle lifecycle
+       bundleContext_getMemoryPool(data->m_context, &pool);
        data->threadId++;
-       int  rc = pthread_create(&m_logTestThread, NULL, LogServiceTest, data);
+       rc = apr_thread_create(&m_logTestThread, NULL, LogServiceTest, data, 
pool);
 }
 
 void stopTestThread() {
        // thread should cooperatively shutdown on the next iteration, because 
field is now null
-       pthread_t testThread = m_logTestThread;
-       pthread_cancel(testThread);
-       pthread_join(testThread, NULL);
+       apr_thread_t *testThread = m_logTestThread;
+       // pthread_cancel(testThread);
+       apr_thread_join(APR_SUCCESS, testThread);
        m_logTestThread = 0;
 }
 
 void pauseTestThread() {
        // sleep for a bit
-       sleep(5);
+       apr_sleep(5);
 }
 
 void alternativeLog(char *message, THREAD_DATA data) {

Modified: 
incubator/celix/trunk/examples/whiteboard/publisherA/private/src/activator.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/whiteboard/publisherA/private/src/activator.c?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/whiteboard/publisherA/private/src/activator.c 
(original)
+++ 
incubator/celix/trunk/examples/whiteboard/publisherA/private/src/activator.c 
Tue Nov 27 14:17:30 2012
@@ -54,6 +54,7 @@ celix_status_t bundleActivator_start(voi
     apr_pool_t *pool;
     status = bundleContext_getMemoryPool(context, &pool);
     if (status == CELIX_SUCCESS) {
+               PROPERTIES props = NULL;
 
         struct activatorData * data = (struct activatorData *) userData;
         data->ps = apr_pcalloc(pool, sizeof(*(data->ps)));
@@ -62,7 +63,7 @@ celix_status_t bundleActivator_start(voi
         data->ps->publisher = data->pub;
         data->reg = NULL;
 
-        PROPERTIES props = properties_create();
+        props = properties_create();
         properties_set(props, "id", "A");
 
         status = bundleContext_registerService(context, PUBLISHER_NAME, 
data->ps, props, &data->reg);

Modified: 
incubator/celix/trunk/examples/whiteboard/publisherB/private/src/activator.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/whiteboard/publisherB/private/src/activator.c?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/whiteboard/publisherB/private/src/activator.c 
(original)
+++ 
incubator/celix/trunk/examples/whiteboard/publisherB/private/src/activator.c 
Tue Nov 27 14:17:30 2012
@@ -53,14 +53,15 @@ celix_status_t bundleActivator_start(voi
     apr_pool_t *pool;
     status = bundleContext_getMemoryPool(context, &pool);
     if (status == CELIX_SUCCESS) {
+               PROPERTIES props = properties_create();
+
         struct activatorData * data = (struct activatorData *) userData;
         data->ps = apr_pcalloc(pool, sizeof(*(data->ps)));
         data->pub = apr_pcalloc(pool, sizeof(*(data->pub)));
         data->ps->invoke = publisher_invoke;
         data->ps->publisher = data->pub;
         data->reg = NULL;
-
-        PROPERTIES props = properties_create();
+        
                properties_set(props, "id", "B");
 
        bundleContext_registerService(context, PUBLISHER_NAME, data->ps, props, 
&data->reg);

Modified: 
incubator/celix/trunk/examples/whiteboard/publisherService/private/include/publisher_private.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/whiteboard/publisherService/private/include/publisher_private.h?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/whiteboard/publisherService/private/include/publisher_private.h
 (original)
+++ 
incubator/celix/trunk/examples/whiteboard/publisherService/private/include/publisher_private.h
 Tue Nov 27 14:17:30 2012
@@ -30,7 +30,7 @@
 #include "publisher.h"
 
 struct publisher {
-
+       void *data;
 };
 
 void publisher_invoke(PUBLISHER publisher, char * text);

Modified: 
incubator/celix/trunk/examples/whiteboard/tracker/private/src/activator.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/whiteboard/tracker/private/src/activator.c?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- incubator/celix/trunk/examples/whiteboard/tracker/private/src/activator.c 
(original)
+++ incubator/celix/trunk/examples/whiteboard/tracker/private/src/activator.c 
Tue Nov 27 14:17:30 2012
@@ -24,8 +24,6 @@
  *  \copyright Apache License, Version 2.0
  */
 #include <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
 #include "celixbool.h"
 
 #include "bundle_activator.h"
@@ -37,11 +35,11 @@ struct data {
        bundle_context_t context;
        service_tracker_t tracker;
        ARRAY_LIST publishers;
-       pthread_t sender;
+       apr_thread_t *sender;
        bool running;
 };
 
-void * trk_send(void * handle) {
+static void *APR_THREAD_FUNC trk_send(apr_thread_t *thd, void *handle) {
        struct data * data = (struct data *) handle;
        while (data->running) {
                int i;
@@ -49,9 +47,9 @@ void * trk_send(void * handle) {
                        PUBLISHER_SERVICE pub = arrayList_get(data->publishers, 
i);
                        pub->invoke(pub->publisher, "test");
                }
-               sleep(1);
+               apr_sleep(1);
        }
-       pthread_exit(NULL);
+       apr_thread_exit(thd, APR_SUCCESS);
        return NULL;
 }
 
@@ -103,25 +101,20 @@ celix_status_t bundleActivator_start(voi
     status = bundleContext_getMemoryPool(context, &pool);
     if (status == CELIX_SUCCESS) {
         struct data * data = (struct data *) userData;
-        data->context = context;
+               service_tracker_customizer_t cust = NULL;
+               service_tracker_t tracker = NULL;
+        
+               data->context = context;
 
-//        service_tracker_customizer_t cust = (service_tracker_customizer_t) 
apr_palloc(pool, sizeof(*cust));
-//        cust->handle = data;
-//        cust->addedService = addedServ;
-//        cust->addingService = addingServ;
-//        cust->modifiedService = modifiedServ;
-//        cust->removedService = removedServ;
-        service_tracker_customizer_t cust = NULL;
         serviceTrackerCustomizer_create(pool, data, addingServ, addedServ, 
modifiedServ, removedServ, &cust);
-
-        service_tracker_t tracker = NULL;
         serviceTracker_create(pool, context, (char *) PUBLISHER_NAME, cust, 
&tracker);
+
         data->tracker = tracker;
 
         serviceTracker_open(tracker);
 
         data->running = true;
-        pthread_create(&data->sender, NULL, trk_send, data);
+        apr_thread_create(&data->sender, NULL, trk_send, data, pool);
     } else {
         status = CELIX_START_ERROR;
     }
@@ -130,12 +123,12 @@ celix_status_t bundleActivator_start(voi
 
 celix_status_t bundleActivator_stop(void * userData, bundle_context_t context) 
{
     celix_status_t status = CELIX_SUCCESS;
-    printf("Stop\n");
-
     struct data * data = (struct data *) userData;
+
+       printf("Stop\n");
     serviceTracker_close(data->tracker);
     data->running = false;
-    pthread_join(data->sender, NULL);
+    apr_thread_join(APR_SUCCESS, data->sender);
 
     return status;
 }

Modified: 
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/include/tracker.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/whiteboard/tracker_depman/private/include/tracker.h?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/include/tracker.h
 (original)
+++ 
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/include/tracker.h
 Tue Nov 27 14:17:30 2012
@@ -34,7 +34,7 @@ struct data {
        SERVICE service;
        bundle_context_t context;
        ARRAY_LIST publishers;
-       pthread_t sender;
+       apr_thread_t *sender;
        bool running;
        log_service_t logger;
 };

Modified: 
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/whiteboard/tracker_depman/private/src/dependency_activator.c?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
 (original)
+++ 
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
 Tue Nov 27 14:17:30 2012
@@ -25,8 +25,6 @@
  */
 #include <stdlib.h>
 #include <stdio.h>
-#include <pthread.h>
-#include <unistd.h>
 #include "celixbool.h"
 
 #include "dependency_activator_base.h"
@@ -52,18 +50,22 @@ void * dm_create(bundle_context_t contex
 
 void dm_init(void * userData, bundle_context_t context, DEPENDENCY_MANAGER 
manager) {
        struct data * data = (struct data *) userData;
+       SERVICE service = NULL;
+       SERVICE_DEPENDENCY dep = NULL;
+       SERVICE_DEPENDENCY dep2 = NULL;
+
        data->context = context;
 
-       SERVICE service = dependencyActivatorBase_createService(manager);
+       service = dependencyActivatorBase_createService(manager);
        serviceComponent_setImplementation(service, data);
 
-       SERVICE_DEPENDENCY dep = 
dependencyActivatorBase_createServiceDependency(manager);
+       dep = dependencyActivatorBase_createServiceDependency(manager);
        serviceDependency_setRequired(dep, false);
        serviceDependency_setService(dep, PUBLISHER_NAME, "(|(id=A)(id=B))");
        serviceDependency_setCallbacks(dep, tracker_addedServ, 
tracker_modifiedServ, tracker_removedServ);
        serviceComponent_addServiceDependency(service, dep);
 
-       SERVICE_DEPENDENCY dep2 = 
dependencyActivatorBase_createServiceDependency(manager);
+       dep2 = dependencyActivatorBase_createServiceDependency(manager);
     serviceDependency_setRequired(dep2, false);
     serviceDependency_setService(dep2, (char *) LOG_SERVICE_NAME, NULL);
     serviceDependency_setCallbacks(dep2, tracker_addLog, tracker_modifiedLog, 
tracker_removeLog);

Modified: 
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/src/tracker.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/whiteboard/tracker_depman/private/src/tracker.c?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/src/tracker.c 
(original)
+++ 
incubator/celix/trunk/examples/whiteboard/tracker_depman/private/src/tracker.c 
Tue Nov 27 14:17:30 2012
@@ -25,8 +25,6 @@
  */
 #include <stdlib.h>
 #include <stdio.h>
-#include <pthread.h>
-#include <unistd.h>
 #include "celixbool.h"
 
 #include "service.h"
@@ -34,7 +32,7 @@
 #include "tracker.h"
 #include "log_service.h"
 
-void * dp_send(void * handle) {
+static void *APR_THREAD_FUNC dp_send(apr_thread_t *thd, void *handle) {
        struct data * data = (struct data *) handle;
        while (data->running) {
                int i;
@@ -45,9 +43,9 @@ void * dp_send(void * handle) {
                                data->logger->log(data->logger->logger, 
LOG_INFO, "Sending message to publisher");
                        }
                }
-               sleep(1);
+               apr_sleep(1);
        }
-       pthread_exit(NULL);
+       apr_thread_exit(thd, APR_SUCCESS);
        return NULL;
 }
 
@@ -57,14 +55,17 @@ void service_init(void * userData) {
 
 void service_start(void * userData) {
        struct data * data = (struct data *) userData;
+       apr_pool_t *pool = NULL;
+
        data->running = true;
-       pthread_create(&data->sender, NULL, dp_send, data);
+       bundleContext_getMemoryPool(data->context, &pool);
+       apr_thread_create(&data->sender, NULL, dp_send, data, pool);
 }
 
 void service_stop(void * userData) {
        struct data * data = (struct data *) userData;
        data->running = false;
-       pthread_join(data->sender, NULL);
+       apr_thread_join(APR_SUCCESS, data->sender);
 }
 
 void service_destroy(void * userData) {

Modified: incubator/celix/trunk/framework/public/include/celix_errno.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/celix_errno.h?rev=1414201&r1=1414200&r2=1414201&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/celix_errno.h (original)
+++ incubator/celix/trunk/framework/public/include/celix_errno.h Tue Nov 27 
14:17:30 2012
@@ -33,6 +33,8 @@
 
 #include <errno.h>
 
+#include "framework_exports.h"
+
 /*!
  * \defgroup celix_errno Error Codes
  * \ingroup framework
@@ -48,7 +50,7 @@ typedef int celix_status_t;
  * Return a readable string for the given error code.
  *
  */
-char *celix_strerror(celix_status_t errorcode);
+FRAMEWORK_EXPORT char *celix_strerror(celix_status_t errorcode);
 
 /*!
  * Error code indicating successful execution of the function.


Reply via email to