- 修复RouteService中错误过滤home路由的问题 - 后端现在正确返回所有用户有权限的路由 - 添加设备管理相关功能(列表、在线监控、电源管理、远程监控) - 添加详细的修复文档和重启脚本 - 更新权限配置脚本 问题根源:后端代码中有逻辑会过滤掉home路由,导致前端收到空数组,无法生成菜单 解决方案:移除过滤home路由的逻辑,让后端返回所有有权限的路由
95 lines
1.7 KiB
C++
95 lines
1.7 KiB
C++
//----------------------------------------------------------------------------
|
|
//
|
|
// Copyright (C) Intel Corporation, 2006 - 2007.
|
|
//
|
|
// File: GuardedCounter.cpp
|
|
//
|
|
// Contents: A guarded counter.
|
|
//
|
|
// Notes:
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#ifndef _GuardedCounter_cpp__
|
|
#define _GuardedCounter_cpp__
|
|
|
|
#include <GuardedCounter.h>
|
|
#include <ace/Global_Macros.h>
|
|
#include <ace/Null_Mutex.h>
|
|
#include <ace/Mutex.h>
|
|
#include <ace/Guard_T.h>
|
|
|
|
#define TRUE 1
|
|
#define FALSE 0
|
|
|
|
GuardedCounter::GuardedCounter(void)
|
|
{
|
|
_counter=0;
|
|
_MaxValue=INT_MAX;
|
|
}
|
|
|
|
GuardedCounter::~GuardedCounter(void)
|
|
{
|
|
|
|
}
|
|
GuardedCounter::GuardedCounter(ACE_UINT32 MaxVal)
|
|
{
|
|
_counter=0;
|
|
_MaxValue=MaxVal;
|
|
}
|
|
GuardedCounter::GuardedCounter(ACE_UINT32 InitVal,ACE_UINT32 MaxVal)
|
|
{
|
|
_counter=InitVal;
|
|
_MaxValue=MaxVal;
|
|
}
|
|
void GuardedCounter::Increment()
|
|
{
|
|
ACE_GUARD( ACE_Thread_Mutex ,
|
|
lock,
|
|
_counter_mutex);
|
|
_counter++;
|
|
}
|
|
void GuardedCounter::Decrement()
|
|
{
|
|
ACE_GUARD( ACE_Thread_Mutex ,
|
|
lock,
|
|
_counter_mutex);
|
|
_counter--;
|
|
}
|
|
ACE_UINT32 GuardedCounter::GetCounterValue()
|
|
{
|
|
return _counter;
|
|
}
|
|
int GuardedCounter::TryIncrementCheckMax()
|
|
{
|
|
ACE_GUARD_RETURN( ACE_Thread_Mutex ,
|
|
lock,
|
|
_counter_mutex,FALSE);
|
|
if (_counter < _MaxValue){
|
|
_counter++;
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
int GuardedCounter::IncrementCheckMax()
|
|
{
|
|
ACE_GUARD_RETURN( ACE_Thread_Mutex ,
|
|
lock,
|
|
_counter_mutex,FALSE);
|
|
_counter++;
|
|
if (_counter <= _MaxValue){
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
void GuardedCounter::SetMaxValue(ACE_UINT32 val)
|
|
{
|
|
ACE_GUARD( ACE_Thread_Mutex ,
|
|
lock,
|
|
_counter_mutex);
|
|
_MaxValue=val;
|
|
}
|
|
|
|
#endif //_GuardedCounter_cpp__
|