Skip to content

Instantly share code, notes, and snippets.

View zhengjiong's full-sized avatar
🏠
Working from home

zhengjiong zhengjiong

🏠
Working from home
  • ChengDu
View GitHub Profile
@zhengjiong
zhengjiong / ConcurrencyHelpers.kt
Created August 3, 2020 10:25 — forked from objcode/ConcurrencyHelpers.kt
Helpers to control concurrency for one shot requests using Kotlin coroutines.
import kotlinx.coroutines.CoroutineStart.LAZY
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async
import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.yield
import java.util.concurrent.atomic.AtomicReference
import kotlin.DeprecationLevel.ERROR
/*
* Created by Storm Zhang 2014-8-24.
*/
package com.storm.library;
import android.app.Activity;
import android.content.res.Resources;
import android.view.View;
import android.view.View.OnClickListener;