Remove EVLOOP_ONCE calls in filescanner

These calls generate error messages when the loop is already running, which
will be the case when using init-rescan or full-rescan. The only purpose
of these calls seems to be to check for exit signals from the main thread
during a startup bulk scan, where the loop is not running yet. However, we
can check for an exit signal by just setting/checking scan_exit.

This commit also removes the unused filescanner_status().
This commit is contained in:
ejurgensen 2014-09-08 21:57:52 +02:00
parent d2d85b29f4
commit 94c5352db6
2 changed files with 5 additions and 32 deletions

View File

@ -656,9 +656,6 @@ process_deferred_playlists(void)
free(pl->path);
free(pl);
/* Run the event loop */
event_base_loop(evbase_scan, EVLOOP_ONCE | EVLOOP_NONBLOCK);
if (scan_exit)
return;
}
@ -782,7 +779,6 @@ check_speciallib(char *path, const char *libtype)
static void
process_directory(char *path, int flags)
{
struct stacked_dir *bulkstack;
DIR *dirp;
struct dirent buf;
struct dirent *de;
@ -796,24 +792,6 @@ process_directory(char *path, int flags)
int type;
int ret;
if (flags & F_SCAN_BULK)
{
/* Save our directory stack so it won't get handled inside
* the event loop - not its business, we're in bulk mode here.
*/
bulkstack = dirstack;
dirstack = NULL;
/* Run the event loop */
event_base_loop(evbase_scan, EVLOOP_ONCE | EVLOOP_NONBLOCK);
/* Restore our directory stack */
dirstack = bulkstack;
if (scan_exit)
return;
}
DPRINTF(E_DBG, L_SCAN, "Processing directory %s (flags = 0x%x)\n", path, flags);
dirp = opendir(path);
@ -835,6 +813,9 @@ process_directory(char *path, int flags)
for (;;)
{
if (scan_exit)
break;
ret = readdir_r(dirp, &buf, &de);
if (ret != 0)
{
@ -1799,13 +1780,6 @@ exit_cb(int fd, short event, void *arg)
scan_exit = 1;
}
int
filescanner_status(void)
{
return scan_exit;
}
/* Thread: main */
int
filescanner_init(void)
@ -1909,6 +1883,8 @@ filescanner_deinit(void)
}
#endif
scan_exit = 1;
ret = pthread_join(tid_scan, NULL);
if (ret != 0)
{

View File

@ -18,9 +18,6 @@ filescanner_init(void);
void
filescanner_deinit(void);
int
filescanner_status(void);
void
filescanner_process_media(char *path, time_t mtime, off_t size, int type, struct media_file_info *external_mfi);