Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nontravis/29d356df20094efa9d6b167d8fc9ca9b to your computer and use it in GitHub Desktop.
Save nontravis/29d356df20094efa9d6b167d8fc9ca9b to your computer and use it in GitHub Desktop.
testConcurrencyFunction_with_let_but_use_var_directly
fun testConcurrencyFunction(){
Timer("thread_name_1").schedule(0) {
string?.let{
for (i in 1..10) {
Log.i(TRREAD1, "$i")
Log.i(TRREAD1, "string len: ${string!!.length}")
sleep(1000)
}
}
}
Timer("thread_name_2").schedule(0) {
for (i in 1..10) {
Log.i("thread_name_2", "$i")
sleep(900)
if (i >= 5) {
string = null
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment