Skip to content
Snippets Groups Projects
Commit 47033d60 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3218] Add basic threading functionality to gnome client for call elapsed time

parent ccfd5f37
No related branches found
Tags
No related merge requests found
......@@ -33,6 +33,7 @@
#include <sflphone_const.h>
#include <time.h>
#define UNIX_DAY 86400
#define UNIX_WEEK 86400 * 6
#define UNIX_TWO_DAYS 86400 * 2
......
......@@ -35,6 +35,7 @@
#include <glib/gprintf.h>
#include <stdlib.h>
#include <time.h>
#include <pthread.h>
/**
* @enum history_state
......@@ -109,6 +110,7 @@ typedef struct {
gchar* _confID; // The conference ID (NULL if don't participate to a conference)
gchar* _accountID; // The account the call is made with
time_t _time_start; // The timestamp the call was initiating
time_t _time_current; // Clock increment to display call's elapsed time
time_t _time_stop; // The timestamp the call was over
history_state_t _history_state; // The history state if necessary
srtp_state_t _srtp_state; // The state of security on the call
......@@ -149,6 +151,9 @@ typedef struct {
/* The audio codec used for this call, if applicable */
gchar *_audio_codec;
// thread id to increment clock
pthread_t tid;
} callable_obj_t;
void create_new_call (callable_type_t, call_state_t, gchar*, gchar*, gchar*, gchar*, callable_obj_t **);
......
......@@ -75,6 +75,16 @@ enum {
};
void *threaded_clock_incrementer(void *call) {
int count = 0;
while(1) {
printf("Clock: %d\n", count++);
sleep(1);
}
}
/**
* Show popup menu
*/
......
......@@ -81,8 +81,12 @@ main (int argc, char *argv[])
if (g_strcmp0 (argv[i], "--debug") == 0)
log4c_category_set_priority (log4c_sfl_gtk_category, LOG4C_PRIORITY_DEBUG);
// Start GTK application
// GtkWidget *window;
g_thread_init (NULL);
gdk_threads_init ();
gdk_threads_enter ();
// Start GTK application
gtk_init (&argc, &argv);
g_print ("%s %s\n", PACKAGE, VERSION);
......@@ -146,6 +150,8 @@ main (int argc, char *argv[])
gtk_main ();
}
gdk_threads_leave ();
// Cleanly stop logging
shutdown_logging ();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment