mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 21:25:19 -05:00
Fix logdisk
The code was broken in a subtle but crucial way: storage idle callbacks are oneshot so after the first flush everything would stay in the buffer forever and would never be written to the disk thus resulting into many events being lost. This changed correctly registers the idle callback each time the buffer is not empty. Note that the idle storage code checks if a callback has is in the queue already so we don't register twice. Change-Id: Ifdf331d4b757e05b8a6902bf5926cbc7689f5109
This commit is contained in:
parent
630a166a94
commit
c13f21a4d5
2 changed files with 4 additions and 10 deletions
|
|
@ -273,6 +273,8 @@ static int logdiskf_push(void *userp, unsigned char c)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void flush_buffer(void* data);
|
||||
|
||||
void _logdiskf(const char* file, const char level, const char *fmt, ...)
|
||||
{
|
||||
|
||||
|
|
@ -296,9 +298,9 @@ void _logdiskf(const char* file, const char level, const char *fmt, ...)
|
|||
|
||||
vuprintf(logdiskf_push, NULL, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
|
||||
register_storage_idle_func(flush_buffer);
|
||||
}
|
||||
|
||||
static void flush_buffer(void* data)
|
||||
{
|
||||
(void)data;
|
||||
|
|
@ -316,8 +318,4 @@ static void flush_buffer(void* data)
|
|||
logdiskfindex = 0;
|
||||
}
|
||||
|
||||
void init_logdiskf()
|
||||
{
|
||||
register_storage_idle_func(flush_buffer);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue