Represents a thread-safe Boolean value.
コード例 #1
0
ファイル: NetworkSession.cs プロジェクト: shoftee/OpenStory
        /// <summary>
        /// Initializes a new instance of the <see cref="NetworkSession"/> class.
        /// </summary>
        public NetworkSession()
        {
            this.isActive = false;

            this.receiveDescriptor = new ReceiveDescriptor(this);
            this.sendDescriptor = new SendDescriptor(this);
        }
コード例 #2
0
        public void FlipIf_Should_Return_True_When_Flip_Is_Successful()
        {
            var b = new AtomicBoolean(true);

            var flipped = b.FlipIf(true);

            flipped.Should().BeTrue();
        }
コード例 #3
0
ファイル: SendDescriptor.cs プロジェクト: shoftee/OpenStory
        /// <summary>
        /// Initializes a new instance of the <see cref="SendDescriptor"/> class.
        /// </summary>
        /// <param name="container">The <see cref="IDescriptorContainer"/> containing this instance.</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="container" /> is <see langword="null"/>.
        /// </exception>
        public SendDescriptor(IDescriptorContainer container)
            : base(container)
        {
            this.SocketArgs.Completed += this.EndSendAsynchronous;

            this.isSending = new AtomicBoolean(false);
            this.queue = new ConcurrentQueue<byte[]>();
        }
コード例 #4
0
ファイル: ServerSession.cs プロジェクト: shoftee/OpenStory
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerSession"/> class.
        /// </summary>
        public ServerSession(IPacketCodeTable packetCodeTable)
        {
            this.NetworkSessionId = RollingNetworkSessionId.Increment();

            this.isPushing = false;
            this.packets = new ConcurrentQueue<byte[]>();

            this.packetCodeTable = packetCodeTable;

            this.PacketReceived += this.HandlePacketReceived;
        }
コード例 #5
0
ファイル: ServerProcess.cs プロジェクト: shoftee/OpenStory
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerProcess"/> class.
        /// </summary>
        public ServerProcess(
            IServerSessionFactory sessionFactory,
            ISocketAcceptorFactory socketAcceptorFactory,
            IPacketScheduler packetScheduler,
            IRollingIvFactoryProvider rollingIvFactoryProvider,
            IvGenerator ivGenerator,
            ILogger logger)
        {
            this.sessionFactory = sessionFactory;
            this.socketAcceptorFactory = socketAcceptorFactory;
            this.packetScheduler = packetScheduler;
            this.rollingIvFactoryProvider = rollingIvFactoryProvider;
            this.ivGenerator = ivGenerator;
            this.logger = logger;

            this.isConfigured = false;
            this.isDisposed = false;
            this.isRunning = new AtomicBoolean(false);
        }
コード例 #6
0
        public void FlipIf_Should_Set_New_Value_When_Comparand_Matches()
        {
            var b = new AtomicBoolean(true);

            b.FlipIf(true);

            b.Value.Should().BeFalse();
        }
コード例 #7
0
 public void Explicit_Cast_Should_Cast_To_True()
 {
     var b = new AtomicBoolean(true);
     var cast = (bool)b;
     cast.Should().BeTrue();
 }
コード例 #8
0
 public void Explicit_Cast_Should_Cast_To_False()
 {
     var b = new AtomicBoolean(false);
     var cast = (bool)b;
     cast.Should().BeFalse();
 }
コード例 #9
0
 public void Constructor_Should_Set_Value_To_True()
 {
     var b = new AtomicBoolean(true);
     b.Value.Should().BeTrue();
 }
コード例 #10
0
 public void Constructor_Should_Set_Value_To_False()
 {
     var b = new AtomicBoolean(false);
     b.Value.Should().BeFalse();
 }
コード例 #11
0
 public void ToBoolean_Should_Return_True()
 {
     var b = new AtomicBoolean(true);
     b.ToBoolean().Should().BeTrue();
 }
コード例 #12
0
 public void ToBoolean_Should_Return_False()
 {
     var b = new AtomicBoolean(false);
     b.ToBoolean().Should().BeFalse();
 }
コード例 #13
0
 public void Static_ToBoolean_Should_Return_True()
 {
     var b = new AtomicBoolean(true);
     AtomicBoolean.ToBoolean(b).Should().BeTrue();
 }
コード例 #14
0
 public void Static_ToBoolean_Should_Return_False()
 {
     var b = new AtomicBoolean(false);
     AtomicBoolean.ToBoolean(b).Should().BeFalse();
 }
コード例 #15
0
        public void Set_Should_Set_New_Value()
        {
            var b = new AtomicBoolean(false);

            b.Set(true);

            b.Value.Should().BeTrue();
        }