Skip to content

Can multithreading be disabled? #6

Answered by CypherPotato
emrys90 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can set your callback to be syncronized. Static methods are synchronized to the type, and instance methods are synchronized to the instance they are contained in. Only one thread executes with the method marked Synchronized.

Example:

using Sisk.Core.Http;
using Sisk.Core.Routing;
using System.Runtime.CompilerServices;

class Program
{
    static void Main(string[] args)
    {
        HttpServer server = HttpServer.Emit(5155, 
            out HttpServerConfiguration config,
            out var host,
            out var router);

        router += new Route(RouteMethod.Get, "/", Index);

        server.Start();
        Console.WriteLine(server.ListeningPrefixes[0]);

        Thread.S…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by CypherPotato
Comment options

You must be logged in to vote
2 replies
@emrys90
Comment options

@CypherPotato
Comment options

Comment options

You must be logged in to vote
2 replies
@CypherPotato
Comment options

@emrys90
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
2 participants