eio: factorize code to have one place where data are pushed.

This commit is contained in:
Cedric BAIL 2014-03-05 10:41:37 +09:00
parent e1e4774306
commit a31102ab43
4 changed files with 20 additions and 21 deletions

View File

@ -700,13 +700,7 @@ _eio_dir_stat_find_forward(Eio_File_Dir_Ls *async,
async->ls.common.worker.associated = NULL; async->ls.common.worker.associated = NULL;
} }
current = ecore_time_get(); async->pack = eio_pack_send(handler->thread, async->pack, &async->start);
if (current - async->start > EIO_PACKED_TIME)
{
async->start = current;
ecore_thread_feedback(handler->thread, async->pack);
async->pack = NULL;
}
return filter; return filter;
} }

View File

@ -84,13 +84,7 @@ _eio_file_heavy(void *data, Ecore_Thread *thread)
} }
} }
current = ecore_time_get(); pack = eio_pack_send(thread, pack, &start);
if (current - start > EIO_PACKED_TIME)
{
start = current;
ecore_thread_feedback(thread, pack);
pack = NULL;
}
if (ecore_thread_check(thread)) if (ecore_thread_check(thread))
break; break;
@ -174,13 +168,7 @@ _eio_file_eina_ls_heavy(Ecore_Thread *thread, Eio_File_Direct_Ls *async, Eina_It
async->ls.common.worker.associated = NULL; async->ls.common.worker.associated = NULL;
} }
current = ecore_time_get(); pack = eio_pack_send(thread, pack, &start);
if (current - start > EIO_PACKED_TIME)
{
start = current;
ecore_thread_feedback(thread, pack);
pack = NULL;
}
if (ecore_thread_check(thread)) if (ecore_thread_check(thread))
break; break;

View File

@ -181,6 +181,21 @@ eio_associate_free(void *data)
_eio_pool_free(&associate_pool, tmp); _eio_pool_free(&associate_pool, tmp);
} }
Eina_List *
eio_pack_send(Ecore_Thread *thread, Eina_List *pack, double *start)
{
double current;
current = ecore_time_get();
if (current - *start > EIO_PACKED_TIME)
{
*start = current;
ecore_thread_feedback(thread, pack);
return NULL;
}
return pack;
}
/** /**
* @endcond * @endcond

View File

@ -495,4 +495,6 @@ void _eio_monitor_rename(Eio_Monitor *monitor, const char *newpath);
void eio_async_end(void *data, Ecore_Thread *thread); void eio_async_end(void *data, Ecore_Thread *thread);
void eio_async_error(void *data, Ecore_Thread *thread); void eio_async_error(void *data, Ecore_Thread *thread);
Eina_List *eio_pack_send(Ecore_Thread *thread, Eina_List *pack, double *start);
#endif #endif