On September 26, 2014 7:19:24 AM Jef Driesen jef@libdivecomputer.org wrote:
On 2014-09-26 15:59, Dirk Hohndel wrote:
On Fri, Sep 26, 2014 at 09:52:05AM +0200, Jef Driesen wrote:
- You used global variables for the cache and its bitmap.
I did? Where? There are two static variables in the caching read function.
That's simply not acceptable. Please move this into the device handle.
Why would I move these variables further up? No one else should ever touch them but the function that allocated and manages their content. I don't understand.
Just a quick answer on this item. Each device handle should have it's own cache. Right now, with the static variable (which is basically a global variable accessible from only one function), all device handles are sharing the same cache. It's about thread-safety too.
I'm aware that in practice it's very unlikely that an application will be talking to two devices simultaneously, but that is supported by libdivecomputer.
Duh. That makes perfect sense. Will fix.
/D