Files
textmate/Frameworks/document/src/session.cc
Allan Odgaard a3cedb5c58 Use std::function as callback type for setup_timer
There is a minor functional change in that the custom callback type uses event loop signaling that makes it safe to trigger the callback from a thread. This should however not be necessary for timers (which are all setup on the main thread).
2012-09-09 16:22:19 +02:00

24 lines
466 B
C++

#include "session.h"
#include "collection.h"
#include <cf/timer.h>
#include <oak/debug.h>
OAK_DEBUG_VAR(Session);
namespace document
{
static void perform_session_backup (void* dummy)
{
D(DBF_Session, bug("\n"););
save_session(true);
}
void schedule_session_backup ()
{
static cf::timer_ptr SessionBackupTimer;
D(DBF_Session, bug("\n"););
SessionBackupTimer = cf::setup_timer(0.5, std::bind(&perform_session_backup, nullptr));
}
} /* document */