Notification order after the release of a lock in java (android) -
i'm writing simple file cache. in context, implement three methods modify file : create, read , delete.
when file subject deletion, intend first check whether it's being read , delete afterwards. first want give priority call read on delete. want read able executed multiple threads. (non-exclusive lock)
my first idea have synchronized counter monitor number of reads going on each file in cache. when delete called, checks whether counter > 0, if yes, loops , waits until it's set 0 , continues. don't loop , use safer mechanism.
i glad hear suggestion.
thank you
Comments
Post a Comment