celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Broekhuis <a.broekh...@gmail.com>
Subject Re: svn commit: r1644361 - in /celix/trunk: log_service/private/src/log.c remote_services/discovery/private/src/endpoint_discovery_poller.c
Date Thu, 11 Dec 2014 06:08:57 GMT
Looks good. We can easily add this to the Celix pthread wrapper.

Op do 11 dec. 2014 06:44 schreef Bjoern Petri <bjoern.petri@sundevil.de>:

>
> Once more learned something new! In my opinion that is the way to go.
> Adding a integer/boolean allows us to (at least) support a check whether
> a thread has been already initialized and initialize it in a proper way,
> respectively.
>
>
>
> On 2014-12-10 21:40, Gerrit Binnenmars wrote:
> > Bjoern Petri schreef op 10-12-2014 18:59:
> >>
> >> How about using a pointer to the celix_thread_t data type and put that
> >> in the log struct?
> > Hello, sounds good to me. Please, have a look at the next link:
> > http://www.linuxforums.org/forum/programming-scripting/
> 123602-pthread_t-question.html
> > So the celix_thread_t data type shall include an integer/boolean to
> > indicate it is created correctly.
> >
> > Gerrit
> >>
> >>
> >> On 2014-12-10 11:05, Alexander Broekhuis wrote:
> >>> @Bjoern: I've changed the thread initialisation to NULL, but
> >>> apparently
> >>> this is not portable (likewise -1 is not portable as well). As far as
> >>> I can
> >>> tell there is no portable way to do this, but on the other hand,
> >>> since a
> >>> pthread_t is not supposed to be directly compared or whatever, it can
> >>> be
> >>> debated that initialisation is not needed..
> >>>
> >>> What do you think?
> >>>
> >>> 2014-12-10 10:59 GMT+01:00 <abroekhuis@apache.org>:
> >>>
> >>>> Author: abroekhuis
> >>>> Date: Wed Dec 10 09:59:15 2014
> >>>> New Revision: 1644361
> >>>>
> >>>> URL: http://svn.apache.org/r1644361
> >>>> Log:
> >>>> CELIX-119: Fixed compiler issues and warnings.
> >>>>
> >>>> Modified:
> >>>>     celix/trunk/log_service/private/src/log.c
> >>>>
> >>>> celix/trunk/remote_services/discovery/private/src/
> endpoint_discovery_poller.c
> >>>> Modified: celix/trunk/log_service/private/src/log.c
> >>>> URL:
> >>>> http://svn.apache.org/viewvc/celix/trunk/log_service/
> private/src/log.c?rev=1644361&r1=1644360&r2=1644361&view=diff
> >>>> ============================================================
> ==================
> >>>> --- celix/trunk/log_service/private/src/log.c (original)
> >>>> +++ celix/trunk/log_service/private/src/log.c Wed Dec 10 09:59:15
> >>>> 2014
> >>>> @@ -62,7 +62,7 @@ celix_status_t log_create(log_pt *logger
> >>>>
> >>>>                 (*logger)->listeners = NULL;
> >>>>                 (*logger)->listenerEntries = NULL;
> >>>> -               (*logger)->listenerThread = -1;
> >>>> +               (*logger)->listenerThread = NULL;
> >>>>                 (*logger)->running = false;
> >>>>
> >>>> arrayList_create(&(*logger)->listeners);
> >>>> @@ -211,7 +211,6 @@ celix_status_t log_addLogListener(log_pt
> >>>>
> >>>>  celix_status_t log_removeLogListener(log_pt logger, log_listener_pt
> >>>> listener) {
> >>>>         celix_status_t status = CELIX_SUCCESS;
> >>>> -    celix_status_t threadStatus = CELIX_SUCCESS;
> >>>>         bool last = false;
> >>>>
> >>>>      status = CELIX_DO_IF(status,
> >>>> celixThreadMutex_lock(&logger->deliverLock));
> >>>> @@ -228,11 +227,11 @@ celix_status_t log_removeLogListener(log
> >>>>          status = CELIX_DO_IF(status,
> >>>> celixThreadMutex_unlock(&logger->deliverLock));
> >>>>
> >>>>                 if (last) {
> >>>> -                   status = CELIX_DO_IF(status,
> >>>> celixThread_join(logger->listenerThread, &threadStatus));
> >>>> +                   status = CELIX_DO_IF(status,
> >>>> celixThread_join(logger->listenerThread, NULL));
> >>>>                 }
> >>>>
> >>>>                 if (status == CELIX_SUCCESS) {
> >>>> -                       logger->listenerThread = -1;
> >>>> +                       logger->listenerThread = NULL;
> >>>>                 }
> >>>>         }
> >>>>
> >>>> @@ -329,6 +328,6 @@ static void * log_listenerThread(void *d
> >>>>
> >>>>         }
> >>>>
> >>>> -    celixThread_exit(status);
> >>>> +    celixThread_exit(NULL);
> >>>>      return NULL;
> >>>>  }
> >>>>
> >>>> Modified:
> >>>> celix/trunk/remote_services/discovery/private/src/
> endpoint_discovery_poller.c
> >>>> URL:
> >>>> http://svn.apache.org/viewvc/celix/trunk/remote_services/
> discovery/private/src/endpoint_discovery_poller.c?
> rev=1644361&r1=1644360&r2=1644361&view=diff
> >>>> ============================================================
> ==================
> >>>> ---
> >>>> celix/trunk/remote_services/discovery/private/src/
> endpoint_discovery_poller.c
> >>>> (original)
> >>>> +++
> >>>> celix/trunk/remote_services/discovery/private/src/
> endpoint_discovery_poller.c
> >>>> Wed Dec 10 09:59:15 2014
> >>>> @@ -190,7 +190,7 @@ celix_status_t endpointDiscoveryPoller_r
> >>>>          return CELIX_BUNDLE_EXCEPTION;
> >>>>      }
> >>>>
> >>>> -    hash_map_entry_pt endpointEntry =
> >>>> hashMap_removeEntryForKey(poller->entries, url);
> >>>> +    hash_map_entry_pt endpointEntry =
> >>>> hashMap_remove(poller->entries,
> >>>> url);
> >>>>
> >>>>      free(hashMapEntry_getKey(endpointEntry));
> >>>>      array_list_pt entries = hashMapEntry_getValue(endpointEntry);
> >>>>
> >>>>
> >>>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message