libsaria: Save queue in a background task
We can easily do this a little bit later to improve performance. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
4b9fde453b
commit
c7abfb6496
|
@ -22,6 +22,16 @@ static void do_load()
|
|||
trigger_callback(QUEUE_REFRESH);
|
||||
}
|
||||
|
||||
static void do_save()
|
||||
{
|
||||
OutFile out("queue.q");
|
||||
list<sid_t>::iterator it;
|
||||
|
||||
out << playqueue.size() << "\n";
|
||||
for (it = playqueue.begin(); it != playqueue.end(); it++)
|
||||
out << (*it) << "\n";
|
||||
}
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
|
||||
|
@ -33,12 +43,8 @@ namespace libsaria
|
|||
|
||||
void queue::save()
|
||||
{
|
||||
OutFile out("queue.q");
|
||||
list<sid_t>::iterator it;
|
||||
|
||||
out << playqueue.size() << "\n";
|
||||
for (it = playqueue.begin(); it != playqueue.end(); it++)
|
||||
out << (*it) << "\n";
|
||||
SaveTask *task = new SaveTask(do_save);
|
||||
task->queue_front();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue