In SCDaemon, it goes like:
(1) card = ctrl->card_ctx
(2) call app_something with card. In the routine, it calls lock_card.
It works most cases, but there is a race condition between scd_update_reader_status_file and those accesses.
Namely, between (1) and (2) above, card may be deallocated.
To fix this situation, we need to introduce a kind of rwlock.
(a) scd_update_reader_status_file and routines like select_application get write lock to access cards (or card-list)
(b) routines app_something get read lock just before getting ctrl->card_ctx
That is, for different card, concurrent accesses should be supported. But, access to deallocated card should not be occurred.