Skip to content

Instantly share code, notes, and snippets.

@nontravis
Last active May 6, 2018 11:06
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/774907eea5ed7ea4dfe9eefca508f061 to your computer and use it in GitHub Desktop.
Save nontravis/774907eea5ed7ea4dfe9eefca508f061 to your computer and use it in GitHub Desktop.
testConcurrencyFunction not use let
fun testConcurrencyFunction(){
Timer("thread_name_1").schedule(0) {
if (string != null) {
for (i in 1..10) {
Log.i("thread_name_1", "$i")
Log.i("thread_name_1", "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