コード例 #1
0
 /// <returns>Returns true if subscription was successful and false if handle needs to be invoked immediately.</returns>
 private bool Subscribe(EventHandle handle)
 {
     return(m_lock.ExecuteRead(() =>
     {
         if (!m_invoked)
         {
             InternalEvent += handle;    // multiple readers can increment this simultaniously because the operation is threadsafe
         }
         return !m_invoked;
     }));
 }
コード例 #2
0
ファイル: IUserDataBase.cs プロジェクト: XSWare/XSLibrary
        /// <summary>
        /// Check if the user data is in the data base and has a valid password
        /// </summary>
        public bool Validate(string username, byte[] password, int accessLevel)
        {
            return(m_lock.ExecuteRead(() =>
            {
                AccountData account = GetAccount(username);
                if (account == null)
                {
                    return false;
                }

                return ValidateHash(account, password) && ValidateAccesslevel(account, accessLevel);
            }));
        }
コード例 #3
0
ファイル: SafeList.cs プロジェクト: XSWare/XSLibrary
 public bool Contains(T item)
 {
     return(m_safeExecutor.ExecuteRead(() => m_internalList.Contains(item)));
 }