Remove nullable disable annotation and mark some properties as nullable.

This commit is contained in:
andy840119
2022-08-07 16:37:42 +08:00
parent 4da2a3b57e
commit f60b839ca3
8 changed files with 7 additions and 25 deletions

View File

@@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Statistics;
using System;
using System.Collections.Generic;

View File

@@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Statistics;
using System;
using System.Collections.Generic;

View File

@@ -1,14 +1,11 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Threading;
using JetBrains.Annotations;
using osu.Framework.Bindables;
using osu.Framework.Development;
using osu.Framework.Platform;
@@ -68,8 +65,7 @@ namespace osu.Framework.Threading
/// in <see cref="ExecutionMode.SingleThread"/> execution mode <see cref="ThreadRunner"/> drives its <see cref="GameThread"/>s
/// manually and sequentially on the main OS thread of the game process.
/// </summary>
[CanBeNull]
public Thread Thread { get; private set; }
public Thread? Thread { get; private set; }
/// <summary>
/// The thread's scheduler.
@@ -80,7 +76,7 @@ namespace osu.Framework.Threading
/// Attach a handler to delegate responsibility for per-frame exceptions.
/// While attached, all exceptions will be caught and forwarded. Thread execution will continue indefinitely.
/// </summary>
public EventHandler<UnhandledExceptionEventArgs> UnhandledException;
public EventHandler<UnhandledExceptionEventArgs>? UnhandledException;
/// <summary>
/// A synchronisation context which posts to this thread.
@@ -141,14 +137,14 @@ namespace osu.Framework.Threading
private readonly GameThreadSynchronizationContext synchronizationContext;
internal PerformanceMonitor Monitor { get; }
internal PerformanceMonitor? Monitor { get; }
internal virtual IEnumerable<StatisticsCounterType> StatisticsCounters => Array.Empty<StatisticsCounterType>();
/// <summary>
/// The main work which is fired on each frame.
/// </summary>
protected event Action OnNewFrame;
protected event Action? OnNewFrame;
private readonly ManualResetEvent initializedEvent = new ManualResetEvent(false);
@@ -164,7 +160,7 @@ namespace osu.Framework.Threading
/// </summary>
private volatile bool exitRequested;
internal GameThread(Action onNewFrame = null, string name = "unknown", bool monitorPerformance = true)
internal GameThread(Action? onNewFrame = null, string name = "unknown", bool monitorPerformance = true)
{
OnNewFrame = onNewFrame;

View File

@@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
namespace osu.Framework.Threading
{
internal class GameThreadScheduler : Scheduler

View File

@@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Platform;
namespace osu.Framework.Threading

View File

@@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Statistics;
using System.Collections.Generic;
using osu.Framework.Development;

View File

@@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

View File

@@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Statistics;
using System;
using System.Collections.Generic;
@@ -13,9 +11,9 @@ namespace osu.Framework.Threading
{
public class UpdateThread : GameThread
{
private readonly DrawThread drawThread;
private readonly DrawThread? drawThread;
public UpdateThread(Action onNewFrame, DrawThread drawThread)
public UpdateThread(Action onNewFrame, DrawThread? drawThread)
: base(onNewFrame, "Update")
{
this.drawThread = drawThread;