#define _POSIX_C_SOURCE 200112L
+#include "iotivity_config.h"
+
#include <string.h>
#include "oicgroup.h"
+#if defined (__TIZENRT__)
+#include <apps/netutils/cJSON.h>
+#else
#include "cJSON.h"
+#endif
#include "cbor.h"
#include "ocpayload.h"
#include "oic_malloc.h"
#include "logger.h"
#include "timer.h"
-#ifndef WITH_ARDUINO
-#include <pthread.h>
-#endif
-
-#define TAG PCF("OICGROUP")
+#define TAG "OIC_RI_GROUP"
#define DESC_DELIMITER "\""
#define ACTION_DELIMITER "*"
pointer = NULL; \
}
-#ifndef WITH_ARDUINO
-pthread_mutex_t lock;
+// Mutex implementation macros
+#if defined(HAVE_PTHREAD_H)
+
+ #include <pthread.h>
+ pthread_mutex_t g_scheduledResourceLock;
+ #define MUTEX_LOCK(ARG_NAME) { pthread_mutex_lock(ARG_NAME); }
+ #define MUTEX_UNLOCK(ARG_NAME) { pthread_mutex_unlock(ARG_NAME); }
+ #define MUTEX_INITIALIZE(ARG_NAME) { }
+ #define MUTEX_TERMINATE(ARG_NAME) { }
+
+#elif defined(HAVE_WINDOWS_H)
+
+ #include <windows.h>
+ CRITICAL_SECTION g_scheduledResourceLock;
+ bool g_initializedScheduledResourceLock = false;
+ #define MUTEX_LOCK(ARG_NAME) { EnterCriticalSection(ARG_NAME); }
+ #define MUTEX_UNLOCK(ARG_NAME) { LeaveCriticalSection(ARG_NAME); }
+ #define MUTEX_INITIALIZE(ARG_NAME) { assert(!g_initializedScheduledResourceLock); \
+ InitializeCriticalSection(ARG_NAME); \
+ g_initializedScheduledResourceLock = true; \
+ }
+ #define MUTEX_TERMINATE(ARG_NAME) { if (g_initializedScheduledResourceLock) \
+ { \
+ DeleteCriticalSection(ARG_NAME); \
+ g_initializedScheduledResourceLock = false; \
+ } \
+ }
+
+#elif defined(WITH_ARDUINO)
+
+ #define MUTEX_LOCK(ARG_NAME) { }
+ #define MUTEX_UNLOCK(ARG_NAME) { }
+ #define MUTEX_INITIALIZE(ARG_NAME) { }
+ #define MUTEX_TERMINATE(ARG_NAME) { }
+
+#else
+
+ ERROR Need mutex implementation on this platform
+
#endif
enum ACTION_TYPE
struct scheduledresourceinfo* next;
} ScheduledResourceInfo;
-ScheduledResourceInfo *scheduleResourceList = NULL;
+ScheduledResourceInfo *g_scheduleResourceList = NULL;
void AddScheduledResource(ScheduledResourceInfo **head,
ScheduledResourceInfo* add)
{
- OC_LOG(INFO, TAG, PCF("AddScheduledResource Entering..."));
+ OIC_LOG(INFO, TAG, "AddScheduledResource Entering...");
-#ifndef WITH_ARDUINO
- pthread_mutex_lock(&lock);
-#endif
+ MUTEX_LOCK(&g_scheduledResourceLock);
ScheduledResourceInfo *tmp = NULL;
if (*head != NULL)
{
*head = add;
}
-#ifndef WITH_ARDUINO
- pthread_mutex_unlock(&lock);
-#endif
+ MUTEX_UNLOCK(&g_scheduledResourceLock);
}
ScheduledResourceInfo* GetScheduledResource(ScheduledResourceInfo *head)
{
- OC_LOG(INFO, TAG, PCF("GetScheduledResource Entering..."));
+ OIC_LOG(INFO, TAG, "GetScheduledResource Entering...");
-#ifndef WITH_ARDUINO
- pthread_mutex_lock(&lock);
-#endif
+ MUTEX_LOCK(&g_scheduledResourceLock);
time_t t_now;
ScheduledResourceInfo *tmp = NULL;
tmp = head;
-#ifndef WITH_ARDUINO
+#if !defined(WITH_ARDUINO)
time(&t_now);
#else
t_now = now();
while (tmp)
{
time_t diffTm = 0;
-#ifndef WITH_ARDUINO
diffTm = timespec_diff(tmp->time, t_now);
-#else
- diffTm = timespec_diff(tmp->time, t_now);
-#endif
if (diffTm <= (time_t) 0)
{
- OC_LOG(INFO, TAG, PCF("return Call INFO."));
+ OIC_LOG(INFO, TAG, "return Call INFO.");
goto exit;
}
}
exit:
-#ifndef WITH_ARDUINO
- pthread_mutex_unlock(&lock);
-#endif
+
+ MUTEX_UNLOCK(&g_scheduledResourceLock);
+
if (tmp == NULL)
{
- OC_LOG(INFO, TAG, PCF("Cannot Find Call Info."));
+ OIC_LOG(INFO, TAG, "Cannot Find Call Info.");
}
return tmp;
}
ScheduledResourceInfo* GetScheduledResourceByActionSetName(ScheduledResourceInfo *head, char *setName)
{
- OC_LOG(INFO, TAG, PCF("GetScheduledResourceByActionSetName Entering..."));
+ OIC_LOG(INFO, TAG, "GetScheduledResourceByActionSetName Entering...");
+
+ MUTEX_LOCK(&g_scheduledResourceLock);
-#ifndef WITH_ARDUINO
- pthread_mutex_lock(&lock);
-#endif
ScheduledResourceInfo *tmp = NULL;
tmp = head;
{
if (strcmp(tmp->actionset->actionsetName, setName) == 0)
{
- OC_LOG(INFO, TAG, PCF("return Call INFO."));
+ OIC_LOG(INFO, TAG, "return Call INFO.");
goto exit;
}
tmp = tmp->next;
}
exit:
-#ifndef WITH_ARDUINO
- pthread_mutex_unlock(&lock);
-#endif
+
+ MUTEX_UNLOCK(&g_scheduledResourceLock);
+
if (tmp == NULL)
{
- OC_LOG(INFO, TAG, PCF("Cannot Find Call Info."));
+ OIC_LOG(INFO, TAG, "Cannot Find Call Info.");
}
return tmp;
}
void RemoveScheduledResource(ScheduledResourceInfo **head,
ScheduledResourceInfo* del)
{
-#ifndef WITH_ARDUINO
- pthread_mutex_lock(&lock);
-#endif
- OC_LOG(INFO, TAG, PCF("RemoveScheduledResource Entering..."));
+
+ MUTEX_LOCK(&g_scheduledResourceLock);
+
+ OIC_LOG(INFO, TAG, "RemoveScheduledResource Entering...");
ScheduledResourceInfo *tmp = NULL;
if (del == NULL)
{
+
+ MUTEX_UNLOCK(&g_scheduledResourceLock);
+
return;
}
}
OCFREE(del)
-#ifndef WITH_ARDUINO
- pthread_mutex_unlock(&lock);
-#endif
+
+ MUTEX_UNLOCK(&g_scheduledResourceLock);
}
typedef struct aggregatehandleinfo
void DeleteActionSet(OCActionSet** actionset)
{
+ OCAction* pointer = NULL;
+ OCAction* pDel = NULL;
+
if(*actionset == NULL)
return;
- OCAction* pointer = (*actionset)->head;
- OCAction* pDel = NULL;
+ pointer = (*actionset)->head;
while (pointer)
{
return OC_STACK_ERROR;
}
-OCStackResult DeleteActionSets(OCResource** resource)
-{
- OCActionSet *pointer = (*resource)->actionsetHead;
- OCActionSet *pDel = pointer;
-
- while (pointer)
- {
- pDel = pointer;
- pointer = pointer->next;
-
- DeleteActionSet(&pDel);
- pDel->next = NULL;
- }
-
- (*resource)->actionsetHead = NULL;
- return OC_STACK_OK;
-}
-
OCStackResult GetActionSet(const char *actionName, OCActionSet *head,
OCActionSet** actionset)
{
{
OCStackResult result = OC_STACK_OK;
- char *actionSetStr;
+ char *actionSetStr = NULL;
if( NULL == ehRequest->payload )
{
OCFREE(*value)
}
+ OCFREE(actionSetStr);
+
return result;
}
OCStackResult ExtractActionSetNameAndDelaytime(char *pChar, char **setName,
long int *pa)
{
- char *token, *tokenPtr;
+ char *token = NULL, *tokenPtr = NULL;
OCStackResult result = OC_STACK_OK;
token = (char*) strtok_r(pChar, ACTION_DELIMITER, &tokenPtr);
+ VARIFY_POINTER_NULL(token, result, exit)
+
*setName = (char *) OICMalloc(strlen(token) + 1);
VARIFY_POINTER_NULL(*setName, result, exit)
VARIFY_PARAM_NULL(token, result, exit)
OCAction *action = NULL;
OCCapability *capa = NULL;
- OC_LOG(INFO, TAG, PCF("Build ActionSet Instance."));
+ OIC_LOG(INFO, TAG, "Build ActionSet Instance.");
*set = (OCActionSet*) OICMalloc(sizeof(OCActionSet));
VARIFY_POINTER_NULL(*set, result, exit)
iterToken = (char *) strtok_r(actiondesc, ACTION_DELIMITER, &iterTokenPtr);
+ VARIFY_POINTER_NULL(iterToken, result, exit);
// ActionSet Name
memset(*set, 0, sizeof(OCActionSet));
// yyyy-mm-dd hh:mm:ss d
iterToken = (char *) strtok_r(NULL, ACTION_DELIMITER, &iterTokenPtr);
VARIFY_PARAM_NULL(iterToken, result, exit)
-#ifndef WITH_ARDUINO
- sscanf(iterToken, "%ld %u", &(*set)->timesteps, &(*set)->type);
+#if !defined(WITH_ARDUINO)
+ if( 2 != sscanf(iterToken, "%ld %u", &(*set)->timesteps, &(*set)->type) )
+ {
+ // If the return value should be 2, the number of items in the argument. Otherwise, it fails.
+ goto exit;
+ }
#endif
- OC_LOG_V(INFO, TAG, "ActionSet Name : %s", (*set)->actionsetName);
+ OIC_LOG_V(INFO, TAG, "ActionSet Name : %s", (*set)->actionsetName);
iterToken = (char *) strtok_r(NULL, ACTION_DELIMITER, &iterTokenPtr);
while (iterToken)
attrIterToken = (char *) strtok_r(attr, ATTR_ASSIGN,
&attrIterTokenPtr);
+ VARIFY_POINTER_NULL(attrIterToken, result, exit);
+
key = (char *) OICMalloc(strlen(attrIterToken) + 1);
VARIFY_POINTER_NULL(key, result, exit)
VARIFY_PARAM_NULL(attrIterToken, result, exit)
attrIterToken = (char *) strtok_r(NULL, ATTR_ASSIGN,
&attrIterTokenPtr);
+ VARIFY_POINTER_NULL(attrIterToken, result, exit);
value = (char *) OICMalloc(strlen(attrIterToken) + 1);
VARIFY_POINTER_NULL(value, result, exit)
VARIFY_PARAM_NULL(attrIterToken, result, exit)
if (strcmp(key, "uri") == 0)
{
- OC_LOG(INFO, TAG, PCF("Build OCAction Instance."));
+ OIC_LOG(INFO, TAG, "Build OCAction Instance.");
- if(action)
- {
- OICFree(action->resourceUri);
- OICFree(action);
- }
action = (OCAction*) OICMalloc(sizeof(OCAction));
VARIFY_POINTER_NULL(action, result, exit)
memset(action, 0, sizeof(OCAction));
{
if ((key != NULL) && (value != NULL))
{
- OC_LOG(INFO, TAG, PCF("Build OCCapability Instance."));
+ OIC_LOG(INFO, TAG, "Build OCCapability Instance.");
capa = (OCCapability*) OICMalloc(sizeof(OCCapability));
VARIFY_POINTER_NULL(capa, result, exit)
OCFREE(desc)
OCFREE(capa)
OCFREE(action)
+ OCFREE((*set)->actionsetName)
OCFREE(*set)
OCFREE(key)
OCFREE(value)
char temp[1024] = { 0 };
size_t remaining = sizeof(temp) - 1;
OCStackResult res = OC_STACK_ERROR;
+ char* actionTypeStr = NULL;
OCAction *action = actionset->head;
if (remaining >= strlen(actionset->actionsetName) + 1)
{
- strcat(temp, actionset->actionsetName);
+ strncat(temp, actionset->actionsetName, strlen(actionset->actionsetName));
remaining -= strlen(actionset->actionsetName);
- strcat(temp, ACTION_DELIMITER);
+ strncat(temp, ACTION_DELIMITER, strlen(ACTION_DELIMITER));
remaining--;
}
else
goto exit;
}
+ actionTypeStr = (char *)OICMalloc(1024);
+ if(actionTypeStr != NULL)
+ {
+ sprintf(actionTypeStr, "%ld %u", actionset->timesteps, actionset->type);
+ if(remaining >= strlen(actionTypeStr) + strlen(ACTION_DELIMITER) + 1)
+ {
+ strncat(temp, actionTypeStr, strlen(actionTypeStr));
+ remaining -= strlen(actionTypeStr);
+ strncat(temp, ACTION_DELIMITER, strlen(ACTION_DELIMITER));
+ remaining -= strlen(ACTION_DELIMITER);
+ OICFree(actionTypeStr);
+ }
+ else
+ {
+ OICFree(actionTypeStr);
+ res = OC_STACK_ERROR;
+ goto exit;
+ }
+ }
+ else
+ {
+ res = OC_STACK_ERROR;
+ goto exit;
+ }
+
while (action != NULL)
{
if (remaining < (strlen("uri=") + strlen(action->resourceUri) + 1))
res = OC_STACK_ERROR;
goto exit;
}
+
strcat(temp, "uri=");
remaining -= strlen("uri=");
strcat(temp, action->resourceUri);
goto exit;
}
strcat(temp, "|");
+ remaining --;
}
}
{
(void)context;
(void)clientResponse;
- OC_LOG(INFO, TAG, PCF("Entering ActionSetCB"));
+ OIC_LOG(INFO, TAG, "Entering ActionSetCB");
ClientRequestInfo *info = GetClientRequestInfo(clientRequstList, handle);
if(NULL == clientResponse->payload)
{
- OC_LOG(ERROR, TAG, "Error sending response");
+ OIC_LOG(ERROR, TAG, "Error sending response");
return OC_STACK_DELETE_TRANSACTION;
}
// Format the response. Note this requires some info about the request
- response.requestHandle = info->ehRequest;
+ response.requestHandle = info->ehRequest->requestId;
response.resourceHandle = info->collResource;
response.payload = clientResponse->payload;
response.numSendVendorSpecificHeaderOptions = 0;
// Send the response
if (OCDoResponse(&response) != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "Error sending response");
+ OIC_LOG(ERROR, TAG, "Error sending response");
return OC_STACK_DELETE_TRANSACTION;
}
char *jsonStr;
uint16_t jsonLen;
- OC_LOG(INFO, TAG, PCF("Entering BuildActionJSON"));
+ OIC_LOG(INFO, TAG, "Entering BuildActionJSON");
json = cJSON_CreateObject();
cJSON_AddItemToObject(json, "rep", body = cJSON_CreateObject());
jsonLen = strlen(jsonStr);
if (jsonLen < *remaining)
{
- strcat((char*) bufferPtr, jsonStr);
+ strncat((char*) bufferPtr, jsonStr, jsonLen);
*remaining -= jsonLen;
bufferPtr += jsonLen;
ret = OC_STACK_OK;
if (!payload)
{
- OC_LOG(INFO, TAG, PCF("Failed to create put payload object"));
+ OIC_LOG(INFO, TAG, "Failed to create put payload object");
return NULL;
}
sizeof(ClientRequestInfo));
if( info == NULL )
+ {
+ OCFREE(payload);
return OC_STACK_NO_MEMORY;
+ }
memset(info, 0, sizeof(ClientRequestInfo));
void DoScheduledGroupAction()
{
- OC_LOG(INFO, TAG, PCF("DoScheduledGroupAction Entering..."));
- ScheduledResourceInfo* info = GetScheduledResource(scheduleResourceList);
+ OIC_LOG(INFO, TAG, "DoScheduledGroupAction Entering...");
+ ScheduledResourceInfo* info = GetScheduledResource(g_scheduleResourceList);
if (info == NULL)
{
- OC_LOG(INFO, TAG, PCF("Target resource is NULL"));
+ OIC_LOG(INFO, TAG, "Target resource is NULL");
goto exit;
}
else if (info->resource == NULL)
{
- OC_LOG(INFO, TAG, PCF("Target resource is NULL"));
+ OIC_LOG(INFO, TAG, "Target resource is NULL");
goto exit;
}
else if (info->actionset == NULL)
{
- OC_LOG(INFO, TAG, PCF("Target ActionSet is NULL"));
+ OIC_LOG(INFO, TAG, "Target ActionSet is NULL");
goto exit;
}
else if (info->ehRequest == NULL)
{
- OC_LOG(INFO, TAG, PCF("Target ActionSet is NULL"));
+ OIC_LOG(INFO, TAG, "Target ActionSet is NULL");
goto exit;
}
-#ifndef WITH_ARDUINO
- pthread_mutex_lock(&lock);
-#endif
+
+ MUTEX_LOCK(&g_scheduledResourceLock);
+
DoAction(info->resource, info->actionset, info->ehRequest);
-#ifndef WITH_ARDUINO
- pthread_mutex_unlock(&lock);
-#endif
+
+ MUTEX_UNLOCK(&g_scheduledResourceLock);
+
if (info->actionset->type == RECURSIVE)
{
if (schedule)
{
- OC_LOG(INFO, TAG, PCF("Building New Call Info."));
+ OIC_LOG(INFO, TAG, "Building New Call Info.");
memset(schedule, 0, sizeof(ScheduledResourceInfo));
if (info->actionset->timesteps > 0)
{
-#ifndef WITH_ARDUINO
- pthread_mutex_lock(&lock);
-#endif
+ MUTEX_LOCK(&g_scheduledResourceLock);
schedule->resource = info->resource;
schedule->actionset = info->actionset;
schedule->ehRequest = info->ehRequest;
&schedule->timer_id,
&DoScheduledGroupAction);
- OC_LOG(INFO, TAG, PCF("Reregisteration."));
-#ifndef WITH_ARDUINO
- pthread_mutex_unlock(&lock);
-#endif
- AddScheduledResource(&scheduleResourceList, schedule);
+ OIC_LOG(INFO, TAG, "Reregistration.");
+ MUTEX_UNLOCK(&g_scheduledResourceLock);
+ AddScheduledResource(&g_scheduleResourceList, schedule);
}
else
{
}
}
- RemoveScheduledResource(&scheduleResourceList, info);
+ RemoveScheduledResource(&g_scheduleResourceList, info);
exit:
{
OCStackResult stackRet = OC_STACK_ERROR;
- OC_LOG(INFO, TAG, PCF("Group Action is requested."));
+ OIC_LOG(INFO, TAG, "Group Action is requested.");
char *doWhat = NULL;
char *details = NULL;
if(stackRet != OC_STACK_OK)
{
- OC_LOG_V(ERROR, TAG, "ExtractKeyValueFromRequest failed: %d", stackRet);
+ OIC_LOG_V(ERROR, TAG, "ExtractKeyValueFromRequest failed: %d", stackRet);
return stackRet;
}
if (method == OC_REST_PUT)
{
- OC_LOG(INFO, TAG, PCF("Group Action[PUT]."));
+ OIC_LOG(INFO, TAG, "Group Action[PUT].");
if (strcmp(doWhat, ACTIONSET) == 0)
{
{
DeleteActionSet( &actionSet );
}
- OC_LOG(INFO, TAG, PCF("Duplicated ActionSet "));
+ OIC_LOG(INFO, TAG, "Duplicated ActionSet ");
}
}
else
if(!payload)
{
- OC_LOG(ERROR, TAG, PCF("Failed to allocate Payload"));
+ OIC_LOG(ERROR, TAG, "Failed to allocate Payload");
stackRet = OC_STACK_ERROR;
}
else
// Send the response
if (OCDoResponse(&response) != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "Error sending response");
+ OIC_LOG(ERROR, TAG, "Error sending response");
stackRet = OC_STACK_ERROR;
}
}
+ OCRepPayloadDestroy(payload);
}
else if (method == OC_REST_POST)
{
if (GetActionSet(details, resource->actionsetHead,
&actionset) != OC_STACK_OK)
{
- OC_LOG(INFO, TAG, PCF("ERROR"));
+ OIC_LOG(INFO, TAG, "ERROR");
stackRet = OC_STACK_ERROR;
}
if (actionset == NULL)
{
- OC_LOG(INFO, TAG, PCF("Cannot Find ActionSet"));
+ OIC_LOG(INFO, TAG, "Cannot Find ActionSet");
stackRet = OC_STACK_ERROR;
}
else
{
- OC_LOG(INFO, TAG, PCF("Group Action[POST]."));
+ OIC_LOG(INFO, TAG, "Group Action[POST].");
+ OCServerRequest *request =
+ GetServerRequestUsingHandle(ehRequest->requestHandle);
+ if (NULL == request)
+ {
+ stackRet = OC_STACK_ERROR;
+ goto exit;
+ }
+
if (actionset->type == NONE)
{
- OC_LOG_V(INFO, TAG, "Execute ActionSet : %s",
+ OIC_LOG_V(INFO, TAG, "Execute ActionSet : %s",
actionset->actionsetName);
unsigned int num = GetNumOfTargetResource(
actionset->head);
- ((OCServerRequest *) ehRequest->requestHandle)->ehResponseHandler =
- HandleAggregateResponse;
- ((OCServerRequest *) ehRequest->requestHandle)->numResponses =
- num + 1;
+ request->ehResponseHandler = HandleAggregateResponse;
+ request->numResponses = num + 1;
+
+ DoAction(resource, actionset, request);
- DoAction(resource, actionset,
- (OCServerRequest*) ehRequest->requestHandle);
stackRet = OC_STACK_OK;
}
else
{
- OC_LOG_V(INFO, TAG, "Execute Scheduled ActionSet : %s",
+ OIC_LOG_V(INFO, TAG, "Execute Scheduled ActionSet : %s",
actionset->actionsetName);
delay =
if (schedule)
{
- OC_LOG(INFO, TAG, PCF("Building New Call Info."));
+ OIC_LOG(INFO, TAG, "Building New Call Info.");
memset(schedule, 0,
sizeof(ScheduledResourceInfo));
-
+ MUTEX_LOCK(&g_scheduledResourceLock);
schedule->resource = resource;
schedule->actionset = actionset;
- schedule->ehRequest =
- (OCServerRequest*) ehRequest->requestHandle;
+ schedule->ehRequest = request;
+ MUTEX_UNLOCK(&g_scheduledResourceLock);
if (delay > 0)
{
- OC_LOG_V(INFO, TAG, "delay_time is %lf seconds.",
+ OIC_LOG_V(INFO, TAG, "delay_time is %ld seconds.",
actionset->timesteps);
-
+ MUTEX_LOCK(&g_scheduledResourceLock);
schedule->time = registerTimer(delay,
&schedule->timer_id,
&DoScheduledGroupAction);
-
- AddScheduledResource(&scheduleResourceList,
+ MUTEX_UNLOCK(&g_scheduledResourceLock);
+ AddScheduledResource(&g_scheduleResourceList,
schedule);
stackRet = OC_STACK_OK;
}
else if (strcmp(doWhat, "CancelAction") == 0)
{
ScheduledResourceInfo *info =
- GetScheduledResourceByActionSetName(scheduleResourceList, details);
+ GetScheduledResourceByActionSetName(g_scheduleResourceList, details);
if(info != NULL)
{
+ MUTEX_LOCK(&g_scheduledResourceLock);
unregisterTimer(info->timer_id);
+ MUTEX_UNLOCK(&g_scheduledResourceLock);
- RemoveScheduledResource(&scheduleResourceList, info);
+ RemoveScheduledResource(&g_scheduleResourceList, info);
stackRet = OC_STACK_OK;
}
else
if(!payload)
{
- OC_LOG(ERROR, TAG, PCF("Failed to allocate Payload"));
+ OIC_LOG(ERROR, TAG, "Failed to allocate Payload");
stackRet = OC_STACK_ERROR;
}
else
// Send the response
if (OCDoResponse(&response) != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "Error sending response");
+ OIC_LOG(ERROR, TAG, "Error sending response");
stackRet = OC_STACK_ERROR;
}
}
+ OCRepPayloadDestroy(payload);
}
exit:
return stackRet;
}
+OCStackResult InitializeScheduleResourceList()
+{
+ MUTEX_INITIALIZE(&g_scheduledResourceLock);
+
+ g_scheduleResourceList = NULL;
+ return OC_STACK_OK;
+}
+
+void TerminateScheduleResourceList()
+{
+ assert(g_scheduleResourceList == NULL);
+
+ MUTEX_TERMINATE(&g_scheduledResourceLock);
+}