/* Timer example.
 */

#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <Ecore.h>


Ecore_Timer *timer1 = NULL;
Ecore_Timer *timer2 = NULL;


int
timer1_tick (void *data) {
  printf ("TIMER 1\n");
  return 1;
}

int
timer2_tick (void *data) {
  printf ("TIMER 2\n");
  return 1;
}

void *
thread_efl (void *arg)
{
  (void) arg;

  ecore_main_loop_begin ();

  pthread_exit (0);
}

int
init_efl (pthread_t th_efl)
{
  ecore_init ();

  if (pthread_create (&th_efl, NULL, thread_efl, NULL) >= 0)
    return 0;

  return -1;
}

int main (void) {
  pthread_t th;

  ecore_init ();

  //printf ("create timer 1\n");
  //timer1 = ecore_timer_add(1.0, timer1_tick, NULL);

  init_efl (th);

  printf ("wait 5 sec\n");
  sleep (5);

  printf ("create timer 2\n");
  timer2 = ecore_timer_add (1.0, timer2_tick, NULL);

  while (1)
    sleep (100000);

  ecore_shutdown ();
  return 0;
}
