diff options
author | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2005-03-22 06:47:53 +0000 |
---|---|---|
committer | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2005-03-22 06:47:53 +0000 |
commit | e2de0c5ed7bbbe4b236246e8bfd71cc87c8d974f (patch) | |
tree | 616f2f0a482597e3968e281ccf8adcfd04f45bbc /muggle-plugin/mg_thread_sync.c | |
parent | 101360901576c7e91196de60e2e6ebd6a4b145dd (diff) | |
download | vdr-plugin-muggle-e2de0c5ed7bbbe4b236246e8bfd71cc87c8d974f.tar.gz vdr-plugin-muggle-e2de0c5ed7bbbe4b236246e8bfd71cc87c8d974f.tar.bz2 |
Added 0.1.6 beta tag0.1.6-BETA
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/tags/0.1.6-BETA@586 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'muggle-plugin/mg_thread_sync.c')
-rw-r--r-- | muggle-plugin/mg_thread_sync.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/muggle-plugin/mg_thread_sync.c b/muggle-plugin/mg_thread_sync.c new file mode 100644 index 0000000..85b55a6 --- /dev/null +++ b/muggle-plugin/mg_thread_sync.c @@ -0,0 +1,63 @@ + +#include <mysql/mysql.h> + +#include "mg_thread_sync.h" +#include "mg_sync.h" + +static mgThreadSync* the_instance = NULL; + +mgThreadSync* mgThreadSync::get_instance() +{ + if( !the_instance ) + { + the_instance = new mgThreadSync(); + } + + + if( the_instance->Active() ) + { + return NULL; + } + else + { + return the_instance; + } +} + +void mgThreadSync::SetArguments( char * const * path_argv, bool delete_missing ) +{ + m_path = path_argv; + m_delete = delete_missing; +} + +bool mgThreadSync::Sync(char * const * path_argv, bool delete_missing ) +{ + mgThreadSync *s = mgThreadSync::get_instance(); + if( s ) + { + s->SetArguments( path_argv, delete_missing ); + s->Start(); + + return true; + } + else + { + return false; + } +} + +void +mgThreadSync::Action() +{ + mysql_thread_init(); + + if( m_path ) + { + mgSync s; + s.Sync( m_path, m_delete ); + } + + mysql_thread_end(); +} + + |