Пример #1
0
    public static void Main()
    {
        var jq = new JobQueue();

        // One user submits three jobs at time=27
        var rid1 = jq.Submit(new Ip("62.150.83.11"), 27);

        _ = jq.Submit(new Ip("62.150.83.11"), 27);

        // One user submits three jobs at time=27
        var rid3 = jq.Submit(new Ip("62.150.83.11"), 27);

        // One job is executed
        jq.ExecuteOne();

        // Another user submits two jobs at time=55
        _ = jq.Submit(new Ip("130.225.17.5"), 55);
        _ = jq.Submit(new Ip("130.225.17.5"), 55);

        // One more job is executed
        jq.ExecuteOne();

        // The first user tries to cancel his first and last job
        jq.Cancel(rid1);
        jq.Cancel(rid3);
        // The remaining jobs are executed
        while (jq.ExecuteOne() != null)
        {
        }
    }