Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment gérer les ASYNC #6

Open
kossolax opened this issue Nov 23, 2021 · 4 comments
Open

Comment gérer les ASYNC #6

kossolax opened this issue Nov 23, 2021 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@kossolax
Copy link
Collaborator

kossolax commented Nov 23, 2021

See bellow.

@kossolax
Copy link
Collaborator Author

kossolax commented Nov 27, 2021

        async static Task Toast() {
            Log.Info( "2" );
            await Task.DelaySeconds( 10.0f );
            Log.Info( "4" );
        }

        public static void Show()
        {
              Log.Info( "1" );
            _ = Toast();
            Log.Info( "3" );
        }

@kossolax
Copy link
Collaborator Author

kossolax commented Nov 27, 2021

        async static Task<bool> Toast() {
            Log.Info( "2" );
            await Task.DelaySeconds( 10.0f );
            Log.Info( "3" );
            return true;
        }

        public static void Show()
        {
            Log.Info( "1" );
            _ = Toast().Result;
            Log.Info( "4" );
        }

@kossolax
Copy link
Collaborator Author

kossolax commented Nov 28, 2021

8f663a0

Semble OK d'overide un sync en async

public override void ClientJoined( Client client ) {
    client.Pawn = new Player();
   client.Pawn.respawn();
}
public async override void ClientJoined( Client client ) {
    client.Pawn = new Player();
   await Task.DelaySeconds(10);
   client.Pawn.respawn();
}

@kossolax
Copy link
Collaborator Author

kossolax commented Nov 28, 2021

Comment gérer l'async dans les endroits foireux, tel qu'en plein milieu d'un tick ?

		private async Task<bool> MyTask() {
			Log.Info( "a" );
			await Task.DelaySeconds(10);
			Log.Info( "b" );
			return true;
		}

		public override void Simulate( Client cl )
		{
			if ( IsServer )
				_ = MyTask();
		}

@kossolax kossolax added the documentation Improvements or additions to documentation label Nov 28, 2021
@kossolax kossolax pinned this issue Nov 28, 2021
@kossolax kossolax changed the title repository async Comment gérer les ASYNC Nov 28, 2021
@tsx-eu tsx-eu deleted a comment from JLag-io Nov 28, 2021
@tsx-eu tsx-eu deleted a comment from Hellhium Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants