Fixed simpleclient crash caused by curResource being altered
authorErich Keane <erich.keane@intel.com>
Fri, 23 Jan 2015 23:21:36 +0000 (15:21 -0800)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Mon, 26 Jan 2015 00:05:54 +0000 (00:05 +0000)
commitcee23f6edca7b6d145a4a7deafdc0550ec3c01eb
tree3ff9a150fea31fdfbf68fc944a4aad6d151fb936
parent344ca0fbb84d50345fa318e6a8d730df36a0a536
Fixed simpleclient crash caused by curResource being altered

The foundResource function is called asynchronously, and was written
in a way that was not thread safe. This fix adds a lock and exit logic
so that it works prooperly and only uses the first found curResource
that matches its requirements.

NOTE: This change (author: Erich Keane) is from 01.org.

Change-Id: I984ce1623ff491713ecf5d621f1283ebad33bfef
Signed-Off-by:Sudarshan Prasad<sudarshan.prasad@intel.com>
Signed-Off-by: Erich Keane <erich.keane@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/236
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
resource/examples/simpleclient.cpp