Esempio n. 1
0
        public void Xor_Int32Value()
        {
            int target      = 0x0F0F0F0F;
            int updateValue = 0x0F00000F;
            int expected    = 0x000F0F00;

            //Act
            var actual = Interlock.Xor(ref target, updateValue);

            //Assert
            actual.Should().Be(expected);
        }
Esempio n. 2
0
        public void Xor_Int64Value()
        {
            long target      = 0x0F0F0F0F00000000;
            long updateValue = 0x0FFFFFFF0F0F0F0F;
            long expected    = 0x00F0F0F00F0F0F0F;

            //Act
            var actual = Interlock.Xor(ref target, updateValue);

            //Assert
            actual.Should().Be(expected);
        }
Esempio n. 3
0
    static public void Take(string name = null)
    {
        if (IsLockedByCurrentProcess(name))
        {
            return;
        }
        name = Convert(name);
        var item = new Interlock {
            ProcessID = Globals.ProcessId, Name = name
        };

        Connection.Insert(item);
    }
Esempio n. 4
0
            public bool[] ParseDBInformation()
            {
                bool[] bInterlock = new bool[36];
                try
                {
                    int i = 0;

                    foreach (var Interlock in typeof(Interlock_Confirm).GetFields())
                    {
                        bInterlock[i] = bool.Parse(Interlock.GetValue(this).ToString());
                        i++;
                    }
                }
                catch (Exception ex)
                {
                    ServiceBaseX._logger.Log(Category.Error, MethodBase.GetCurrentMethod().DeclaringType.Name + "_" + MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
                    return(null);
                }

                return(bInterlock);
            }