OSDN Git Service

OC2 oscl registry race condition
authorJames Dong <jdong@google.com>
Thu, 7 May 2009 18:33:37 +0000 (11:33 -0700)
committerJames Dong <jdong@google.com>
Fri, 8 May 2009 22:01:43 +0000 (15:01 -0700)
commite653c3c234c782c77c901919dab71f7922f9fd8c
tree93a871a3a5379b95fff25c477c55fd8e4c6095db
parent574027efee8fc9359b84745435193a051e3c814c
OC2 oscl registry race condition
The idea is to only initialize the singleton table for once and only once and keep it around forever.
As a result, the lock for locking the whole singleton table is not needed and thus removed in this change.
This approach works only if the client program follows the protocol for using the singleton:
it must call initialize() first and then call the rest methods in this class.

- changed the pointer to a singletontable to be a static object so that it is initialized statically
- removed an extra lock on the whole singletontable, since we don't need it
- moved initialize and cleanup to the header file for optimization. actually, these two methods can be removed. I put the removal of
  these two methods as a FIXME.
oscl/oscl/osclbase/src/oscl_singleton.cpp
oscl/oscl/osclbase/src/oscl_singleton.h