'pthread_cancel bionic'에 해당되는 글 1건

  1. 2013.02.04 pthread_cancel()
안드로이드/포팅2013.02.04 15:59

쉽게 요약하자면 C library가 고작 pthread_cancle지원하자고 너무 커지기 때문에 바이오닉 C에서는 지원 안한단다. 대신 pthread_cleanup_push()와 pthread_cleanup_pop()은 지원하니까 적절히 사용하자.


   pthread_cancel() will *not* be supported in Bionic, because doing this would
   involve making the C library significantly bigger for very little benefit.

   Consider that:

     - A proper implementation must insert pthread cancellation checks in a lot
       of different places of the C library. And conformance is very difficult
       to test properly.

     - A proper implementation must also clean up resources, like releasing
       memory, or unlocking mutexes, properly if the cancellation happens in a
       complex function (e.g. inside gethostbyname() or fprintf() + complex
       formatting rules). This tends to slow down the path of many functions.

     - pthread cancellation cannot stop all threads: e.g. it can't do anything
       against an infinite loop

     - pthread cancellation itself has short-comings and isn't very portable
       (see http://advogato.org/person/slamb/diary.html?start=49 for example).

   All of this is contrary to the Bionic design goals. If your code depends on
   thread cancellation, please consider alternatives.

   Note however that Bionic does implement pthread_cleanup_push() and
   pthread_cleanup_pop(), which can be used to handle cleanups that happen when
   a thread voluntarily exits through pthread_exit() or returning from its
   main function.

'안드로이드 > 포팅' 카테고리의 다른 글

Android Build System 용어  (0) 2013.10.16
GGLContext 에 대하여  (0) 2013.03.24
pthread_cancel()  (0) 2013.02.04
안드로이드 젤리빈 소스 다운로  (0) 2012.10.03
안드로이드 아이스크림샌드위치 vs 진저브레드  (0) 2012.04.07
Ubuntu 11.04 에서 jdk6 깔기  (0) 2012.04.05
Posted by code cat

티스토리 툴바