/// <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; })); }
/// <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); })); }
public bool Contains(T item) { return(m_safeExecutor.ExecuteRead(() => m_internalList.Contains(item))); }