본문 바로가기
[coroutine] Exception handling Exception propagation - Coroutine builder 는 2가지 flavor 가 있다. exception 을 자동으로 전파하는 launch, actor류. 그리고 user 에게 노출되는 async, produce 류. 자동 전파하는 케이스는 Java 의 uncaughtExceptionHandler 와 비슷하게 unhandled exception 이다. 반면에 user 에게 노출되는 경우는 user 가 exception 을 직접 handle 할 수 있다. (돼왕: try-catch 할 수 있다.) 대표적 api 는 await 와 receive 가 있다. - runBlocking{ val job = GlobalScope.launch{ println(“Throwing exception f.. 2019. 3. 4.
[Kotlin] Coroutine 소개 (그렇지만 조금 깊을 수도 있음..) [Kotlin] Coroutine 소개 https://www.slideshare.net/elizarov/introduction-to-kotlin-coroutines -Coroutine 개념은 아주 오래된 녀석이다.Simula 67 이란 언어에서 처음으로 소개된 개념이다. detach : suspension statement resume : resume coroutine execution -Coroutine 은 multithreading 이 나오면서 잠시 out 되어있었다.그러나 최근에 async code 가 많이 사용되면서 다시 주목받기 시작했다. -Thread 는 resource 측면에서 high-load 이며,single thread 만 지원하는 언어들도 있으며,mutable state 가 많고, U.. 2018. 11. 27.
[Kotlin] Coroutines tutorial - async code 쉽게 짜기 [Kotlin] Coroutines tutorial - async code 쉽게 짜기 https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md -Kotlin coroutines 는 async code 를 sync code 의 구조를 바꾸지 않고 짤 수 있게 도와준다. Coroutine Basics - modified내용이 바뀌어서 새로 정리하였습니다. -> Coroutine Basics ( 코루틴 기초 ) 예전 기록을 보고 싶으시면 아래 "더보기" 버튼을 눌러주세요!Hello World Coroutine -launch{ delay(1000L) println(“World!”)}println(“Hello,”)Thread.slee.. 2018. 11. 25.
반응형