trival bug:
  - acquire lock before destroy stream in case calculating task priority
    needs to retreive stream fill level
bug fix: priority cal access destroyed stream
 - while calculating priority, task may access a stream already
   destroyed by the other task of the stream
 - fix: when destroy stream, set the other task's stream point to NULL