fix AuthorizationRegistry race
oops. should only prevent add/remove while iterating, not concurrent iteration.
This commit is contained in:
@@ -290,7 +290,7 @@ public:
|
||||
private:
|
||||
typedef std::map<int, AuthorizationPlugin::shared_pointer> map_t;
|
||||
map_t map;
|
||||
void *busy;
|
||||
size_t busy;
|
||||
mutable epicsMutex mutex;
|
||||
public:
|
||||
|
||||
|
||||
@@ -289,12 +289,11 @@ bool AuthorizationRegistry::remove(const AuthorizationPlugin::shared_pointer& pl
|
||||
|
||||
void AuthorizationRegistry::run(const std::tr1::shared_ptr<PeerInfo>& peer)
|
||||
{
|
||||
int marker;
|
||||
{
|
||||
Guard G(mutex);
|
||||
if(busy)
|
||||
throw std::runtime_error("AuthorizationRegistry busy");
|
||||
busy = ▮
|
||||
busy++;
|
||||
}
|
||||
for(map_t::iterator it(map.begin()), end(map.end()); it!=end; ++it)
|
||||
{
|
||||
@@ -302,8 +301,8 @@ void AuthorizationRegistry::run(const std::tr1::shared_ptr<PeerInfo>& peer)
|
||||
}
|
||||
{
|
||||
Guard G(mutex);
|
||||
assert(busy==&marker);
|
||||
busy = 0;
|
||||
assert(busy>=0);
|
||||
busy--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user