.class public final Lz/a/f0;
.super Lz/a/s0;
.source "DefaultExecutor.kt"

# interfaces
.implements Ljava/lang/Runnable;


# static fields
.field public static volatile _thread:Ljava/lang/Thread;

.field public static volatile debugStatus:I

.field public static final i:J

.field public static final j:Lz/a/f0;


# direct methods
.method public static constructor <clinit>()V
    .locals 4

    new-instance v0, Lz/a/f0;

    invoke-direct {v0}, Lz/a/f0;-><init>()V

    sput-object v0, Lz/a/f0;->j:Lz/a/f0;

    const/4 v1, 0x0

    const/4 v2, 0x1

    const/4 v3, 0x0

    invoke-static {v0, v1, v2, v3}, Lz/a/r0;->b(Lz/a/r0;ZILjava/lang/Object;)V

    sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;

    const-wide/16 v1, 0x3e8

    :try_start_0
    const-string v3, "kotlinx.coroutines.DefaultExecutor.keepAlive"

    invoke-static {v3, v1, v2}, Ljava/lang/Long;->getLong(Ljava/lang/String;J)Ljava/lang/Long;

    move-result-object v1
    :try_end_0
    .catch Ljava/lang/SecurityException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    invoke-static {v1, v2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v1

    :goto_0
    const-string v2, "try {\n            java.l\u2026AULT_KEEP_ALIVE\n        }"

    invoke-static {v1, v2}, Ly/v/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v1}, Ljava/lang/Long;->longValue()J

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Ljava/util/concurrent/TimeUnit;->toNanos(J)J

    move-result-wide v0

    sput-wide v0, Lz/a/f0;->i:J

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    invoke-direct {p0}, Lz/a/s0;-><init>()V

    return-void
.end method


# virtual methods
.method public i()Ljava/lang/Thread;
    .locals 1

    sget-object v0, Lz/a/f0;->_thread:Ljava/lang/Thread;

    if-eqz v0, :cond_0

    goto :goto_0

    :cond_0
    invoke-virtual {p0}, Lz/a/f0;->l()Ljava/lang/Thread;

    move-result-object v0

    :goto_0
    return-object v0
.end method

.method public final declared-synchronized k()V
    .locals 1

    monitor-enter p0

    :try_start_0
    invoke-virtual {p0}, Lz/a/f0;->m()Z

    move-result v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-nez v0, :cond_0

    monitor-exit p0

    return-void

    :cond_0
    const/4 v0, 0x3

    :try_start_1
    sput v0, Lz/a/f0;->debugStatus:I

    const/4 v0, 0x0

    iput-object v0, p0, Lz/a/s0;->_queue:Ljava/lang/Object;

    iput-object v0, p0, Lz/a/s0;->_delayed:Ljava/lang/Object;

    invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    monitor-exit p0

    return-void

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public final declared-synchronized l()Ljava/lang/Thread;
    .locals 2

    monitor-enter p0

    :try_start_0
    sget-object v0, Lz/a/f0;->_thread:Ljava/lang/Thread;

    if-eqz v0, :cond_0

    goto :goto_0

    :cond_0
    new-instance v0, Ljava/lang/Thread;

    const-string v1, "kotlinx.coroutines.DefaultExecutor"

    invoke-direct {v0, p0, v1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;Ljava/lang/String;)V

    sput-object v0, Lz/a/f0;->_thread:Ljava/lang/Thread;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Ljava/lang/Thread;->setDaemon(Z)V

    invoke-virtual {v0}, Ljava/lang/Thread;->start()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :goto_0
    monitor-exit p0

    return-object v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public final m()Z
    .locals 2

    sget v0, Lz/a/f0;->debugStatus:I

    const/4 v1, 0x2

    if-eq v0, v1, :cond_1

    const/4 v1, 0x3

    if-ne v0, v1, :cond_0

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    goto :goto_1

    :cond_1
    :goto_0
    const/4 v0, 0x1

    :goto_1
    return v0
.end method

.method public final declared-synchronized n()Z
    .locals 1

    monitor-enter p0

    :try_start_0
    invoke-virtual {p0}, Lz/a/f0;->m()Z

    move-result v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz v0, :cond_0

    const/4 v0, 0x0

    monitor-exit p0

    return v0

    :cond_0
    const/4 v0, 0x1

    :try_start_1
    sput v0, Lz/a/f0;->debugStatus:I

    invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public run()V
    .locals 12

    sget-object v0, Lz/a/t1;->b:Lz/a/t1;

    invoke-virtual {v0, p0}, Lz/a/t1;->a(Lz/a/r0;)V

    sget-object v0, Lz/a/w1;->a:Lz/a/v1;

    check-cast v0, Lz/a/h0;

    invoke-virtual {v0}, Lz/a/h0;->b()V

    const/4 v0, 0x0

    :try_start_0
    invoke-virtual {p0}, Lz/a/f0;->n()Z

    move-result v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-nez v1, :cond_1

    sput-object v0, Lz/a/f0;->_thread:Ljava/lang/Thread;

    invoke-virtual {p0}, Lz/a/f0;->k()V

    sget-object v0, Lz/a/w1;->a:Lz/a/v1;

    check-cast v0, Lz/a/h0;

    invoke-virtual {v0}, Lz/a/h0;->e()V

    invoke-virtual {p0}, Lz/a/s0;->j()Z

    move-result v0

    if-nez v0, :cond_0

    invoke-virtual {p0}, Lz/a/f0;->i()Ljava/lang/Thread;

    :cond_0
    return-void

    :cond_1
    const-wide v1, 0x7fffffffffffffffL

    move-wide v3, v1

    :cond_2
    :goto_0
    :try_start_1
    invoke-static {}, Ljava/lang/Thread;->interrupted()Z

    invoke-virtual {p0}, Lz/a/s0;->g()J

    move-result-wide v5

    const-wide/16 v7, 0x0

    cmp-long v9, v5, v1

    if-nez v9, :cond_7

    cmp-long v9, v3, v1

    if-nez v9, :cond_6

    sget-object v10, Lz/a/w1;->a:Lz/a/v1;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    check-cast v10, Lz/a/h0;

    :try_start_2
    invoke-virtual {v10}, Lz/a/h0;->a()J

    move-result-wide v10

    if-nez v9, :cond_3

    sget-wide v3, Lz/a/f0;->i:J
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    add-long/2addr v3, v10

    :cond_3
    sub-long v9, v3, v10

    cmp-long v11, v9, v7

    if-gtz v11, :cond_5

    sput-object v0, Lz/a/f0;->_thread:Ljava/lang/Thread;

    invoke-virtual {p0}, Lz/a/f0;->k()V

    sget-object v0, Lz/a/w1;->a:Lz/a/v1;

    check-cast v0, Lz/a/h0;

    invoke-virtual {v0}, Lz/a/h0;->e()V

    invoke-virtual {p0}, Lz/a/s0;->j()Z

    move-result v0

    if-nez v0, :cond_4

    invoke-virtual {p0}, Lz/a/f0;->i()Ljava/lang/Thread;

    :cond_4
    return-void

    :cond_5
    :try_start_3
    invoke-static {v5, v6, v9, v10}, Ly/y/f;->coerceAtMost(JJ)J

    move-result-wide v5

    goto :goto_1

    :cond_6
    sget-wide v9, Lz/a/f0;->i:J

    invoke-static {v5, v6, v9, v10}, Ly/y/f;->coerceAtMost(JJ)J

    move-result-wide v5

    :cond_7
    :goto_1
    cmp-long v9, v5, v7

    if-lez v9, :cond_2

    invoke-virtual {p0}, Lz/a/f0;->m()Z

    move-result v7
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    if-eqz v7, :cond_9

    sput-object v0, Lz/a/f0;->_thread:Ljava/lang/Thread;

    invoke-virtual {p0}, Lz/a/f0;->k()V

    sget-object v0, Lz/a/w1;->a:Lz/a/v1;

    check-cast v0, Lz/a/h0;

    invoke-virtual {v0}, Lz/a/h0;->e()V

    invoke-virtual {p0}, Lz/a/s0;->j()Z

    move-result v0

    if-nez v0, :cond_8

    invoke-virtual {p0}, Lz/a/f0;->i()Ljava/lang/Thread;

    :cond_8
    return-void

    :cond_9
    :try_start_4
    sget-object v7, Lz/a/w1;->a:Lz/a/v1;
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0

    check-cast v7, Lz/a/h0;

    :try_start_5
    invoke-virtual {v7, p0, v5, v6}, Lz/a/h0;->a(Ljava/lang/Object;J)V
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v1

    sput-object v0, Lz/a/f0;->_thread:Ljava/lang/Thread;

    invoke-virtual {p0}, Lz/a/f0;->k()V

    sget-object v0, Lz/a/w1;->a:Lz/a/v1;

    check-cast v0, Lz/a/h0;

    invoke-virtual {v0}, Lz/a/h0;->e()V

    invoke-virtual {p0}, Lz/a/s0;->j()Z

    move-result v0

    if-nez v0, :cond_a

    invoke-virtual {p0}, Lz/a/f0;->i()Ljava/lang/Thread;

    :cond_a
    throw v1
.end method