.class public final Lq9/z;
.super Lq9/j0;
.source ""

# interfaces
.implements Ljava/lang/Runnable;


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

.field private static volatile debugStatus:I

.field public static final x:Lq9/z;

.field public static final y:J


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

    new-instance v0, Lq9/z;

    invoke-direct {v0}, Lq9/z;-><init>()V

    sput-object v0, Lq9/z;->x:Lq9/z;

    const/4 v1, 0x0

    .line 1
    invoke-virtual {v0, v1}, Lq9/i0;->d0(Z)V

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

    const-wide/16 v1, 0x3e8

    :try_start_f
    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_15
    .catch Ljava/lang/SecurityException; {:try_start_f .. :try_end_15} :catch_16

    goto :goto_1a

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

    move-result-object v1

    :goto_1a
    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, Lq9/z;->y:J

    return-void
.end method

.method public constructor <init>()V
    .registers 1

    invoke-direct {p0}, Lq9/j0;-><init>()V

    return-void
.end method


# virtual methods
.method public g0()Ljava/lang/Thread;
    .registers 3

    sget-object v0, Lq9/z;->_thread:Ljava/lang/Thread;

    if-nez v0, :cond_1e

    .line 1
    monitor-enter p0

    :try_start_5
    sget-object v0, Lq9/z;->_thread:Ljava/lang/Thread;

    if-nez v0, :cond_19

    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, Lq9/z;->_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_19
    .catchall {:try_start_5 .. :try_end_19} :catchall_1b

    :cond_19
    monitor-exit p0

    goto :goto_1e

    :catchall_1b
    move-exception v0

    monitor-exit p0

    throw v0

    :cond_1e
    :goto_1e
    return-object v0
.end method

.method public final declared-synchronized n0()V
    .registers 2

    monitor-enter p0

    :try_start_1
    invoke-virtual {p0}, Lq9/z;->o0()Z

    move-result v0
    :try_end_5
    .catchall {:try_start_1 .. :try_end_5} :catchall_14

    if-nez v0, :cond_9

    monitor-exit p0

    return-void

    :cond_9
    const/4 v0, 0x3

    :try_start_a
    sput v0, Lq9/z;->debugStatus:I

    invoke-virtual {p0}, Lq9/j0;->l0()V

    invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
    :try_end_12
    .catchall {:try_start_a .. :try_end_12} :catchall_14

    monitor-exit p0

    return-void

    :catchall_14
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public final o0()Z
    .registers 3

    sget v0, Lq9/z;->debugStatus:I

    const/4 v1, 0x2

    if-eq v0, v1, :cond_b

    const/4 v1, 0x3

    if-ne v0, v1, :cond_9

    goto :goto_b

    :cond_9
    const/4 v0, 0x0

    goto :goto_c

    :cond_b
    :goto_b
    const/4 v0, 0x1

    :goto_c
    return v0
.end method

.method public run()V
    .registers 13

    sget-object v0, Lq9/j1;->a:Lq9/j1;

    .line 1
    sget-object v0, Lq9/j1;->b:Ljava/lang/ThreadLocal;

    invoke-virtual {v0, p0}, Ljava/lang/ThreadLocal;->set(Ljava/lang/Object;)V

    const/4 v0, 0x0

    .line 2
    :try_start_8
    monitor-enter p0
    :try_end_9
    .catchall {:try_start_8 .. :try_end_9} :catchall_83

    :try_start_9
    invoke-virtual {p0}, Lq9/z;->o0()Z

    move-result v1

    if-eqz v1, :cond_11

    const/4 v1, 0x0

    goto :goto_17

    :cond_11
    const/4 v1, 0x1

    sput v1, Lq9/z;->debugStatus:I

    invoke-virtual {p0}, Ljava/lang/Object;->notifyAll()V
    :try_end_17
    .catchall {:try_start_9 .. :try_end_17} :catchall_80

    :goto_17
    :try_start_17
    monitor-exit p0
    :try_end_18
    .catchall {:try_start_17 .. :try_end_18} :catchall_83

    if-nez v1, :cond_29

    .line 3
    sput-object v0, Lq9/z;->_thread:Ljava/lang/Thread;

    invoke-virtual {p0}, Lq9/z;->n0()V

    invoke-virtual {p0}, Lq9/j0;->j0()Z

    move-result v0

    if-nez v0, :cond_28

    invoke-virtual {p0}, Lq9/z;->g0()Ljava/lang/Thread;

    :cond_28
    return-void

    :cond_29
    const-wide v1, 0x7fffffffffffffffL

    move-wide v3, v1

    :cond_2f
    :goto_2f
    :try_start_2f
    invoke-static {}, Ljava/lang/Thread;->interrupted()Z

    invoke-virtual {p0}, Lq9/j0;->k0()J

    move-result-wide v5

    cmp-long v7, v5, v1

    const-wide/16 v8, 0x0

    if-nez v7, :cond_62

    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v10

    cmp-long v7, v3, v1

    if-nez v7, :cond_47

    sget-wide v3, Lq9/z;->y:J
    :try_end_46
    .catchall {:try_start_2f .. :try_end_46} :catchall_83

    add-long/2addr v3, v10

    :cond_47
    sub-long v10, v3, v10

    cmp-long v7, v10, v8

    if-gtz v7, :cond_5c

    sput-object v0, Lq9/z;->_thread:Ljava/lang/Thread;

    invoke-virtual {p0}, Lq9/z;->n0()V

    invoke-virtual {p0}, Lq9/j0;->j0()Z

    move-result v0

    if-nez v0, :cond_5b

    invoke-virtual {p0}, Lq9/z;->g0()Ljava/lang/Thread;

    :cond_5b
    return-void

    :cond_5c
    cmp-long v7, v5, v10

    if-lez v7, :cond_63

    move-wide v5, v10

    goto :goto_63

    :cond_62
    move-wide v3, v1

    :cond_63
    :goto_63
    cmp-long v7, v5, v8

    if-lez v7, :cond_2f

    :try_start_67
    invoke-virtual {p0}, Lq9/z;->o0()Z

    move-result v7
    :try_end_6b
    .catchall {:try_start_67 .. :try_end_6b} :catchall_83

    if-eqz v7, :cond_7c

    sput-object v0, Lq9/z;->_thread:Ljava/lang/Thread;

    invoke-virtual {p0}, Lq9/z;->n0()V

    invoke-virtual {p0}, Lq9/j0;->j0()Z

    move-result v0

    if-nez v0, :cond_7b

    invoke-virtual {p0}, Lq9/z;->g0()Ljava/lang/Thread;

    :cond_7b
    return-void

    :cond_7c
    :try_start_7c
    invoke-static {p0, v5, v6}, Ljava/util/concurrent/locks/LockSupport;->parkNanos(Ljava/lang/Object;J)V

    goto :goto_2f

    :catchall_80
    move-exception v1

    .line 4
    monitor-exit p0

    throw v1
    :try_end_83
    .catchall {:try_start_7c .. :try_end_83} :catchall_83

    :catchall_83
    move-exception v1

    .line 5
    sput-object v0, Lq9/z;->_thread:Ljava/lang/Thread;

    invoke-virtual {p0}, Lq9/z;->n0()V

    invoke-virtual {p0}, Lq9/j0;->j0()Z

    move-result v0

    if-nez v0, :cond_92

    invoke-virtual {p0}, Lq9/z;->g0()Ljava/lang/Thread;

    :cond_92
    throw v1
.end method
