- Add synchronization logic for cache update in NSConsumerInternalTaskController.
- Adapt its synchronization logic, when subscription succeed is checked/updated.
Change-Id: I746a3d3602eab3ac570a6d2ddfcdd4b7dce8e18a
Signed-off-by: YounghyunJoo <yh_.joo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/11201
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
NSCacheList * ProviderCache = *(NSGetProviderCacheList());
NSCacheElement * cacheElement = NSStorageRead(ProviderCache, provider->providerId);
+ NS_VERIFY_NOT_NULL_V(cacheElement);
+
+ pthread_mutex_t * mutex = NSGetCacheMutex();
+ pthread_mutex_lock(mutex);
+
NS_VERIFY_NOT_NULL_V(cacheElement);
NSProvider_internal * prov = (NSProvider_internal *)cacheElement->data;
NSProviderConnectionInfo *infos = prov->connection;
infos->isSubscribing = true;
infos = infos->next;
}
+
+ pthread_mutex_unlock(mutex);
}
void NSConsumerHandleRecvProviderChanged(NSMessage * msg)
#include "NSStorageAdapter.h"
#include "NSConsumerCommon.h"
+pthread_mutex_t * NSGetCacheMutex();
bool NSConsumerCompareIdCacheData(NSCacheType type, void * data, const char * id);
NSResult NSConsumerCacheWriteMessage(NSCacheList * list, NSCacheElement * newObj);