[svn r360] Removed a lot of GStaticMutex references.
1.1 --- a/gmyth/src/gmyth_livetv.c Tue Feb 13 23:15:54 2007 +0000
1.2 +++ b/gmyth/src/gmyth_livetv.c Tue Feb 13 23:17:35 2007 +0000
1.3 @@ -47,7 +47,7 @@
1.4
1.5 static gint tvchain_curr_index = -1;
1.6
1.7 -static GStaticMutex lock = G_STATIC_MUTEX_INIT;
1.8 +/*static GStaticMutex lock = G_STATIC_MUTEX_INIT;*/
1.9
1.10 #define GMYTHTV_TRANSFER_MAX_WAITS 100
1.11
1.12 @@ -77,6 +77,8 @@
1.13 livetv->tvchain = NULL;
1.14 livetv->proginfo = NULL;
1.15 livetv->uri = NULL;
1.16 +
1.17 + livetv->mutex = NULL;
1.18
1.19 }
1.20
1.21 @@ -91,6 +93,7 @@
1.22 }
1.23
1.24 if ( livetv->recorder != NULL ) {
1.25 + //gmyth_livetv_stop_playing(
1.26 g_object_unref (livetv->recorder);
1.27 livetv->recorder = NULL;
1.28 }
1.29 @@ -126,6 +129,12 @@
1.30 livetv->uri = NULL;
1.31 }
1.32
1.33 + if ( livetv->mutex != NULL )
1.34 + {
1.35 + g_mutex_free (livetv->mutex);
1.36 + livetv->mutex = NULL;
1.37 + }
1.38 +
1.39 G_OBJECT_CLASS (gmyth_livetv_parent_class)->dispose (object);
1.40 }
1.41
1.42 @@ -141,7 +150,9 @@
1.43 gmyth_livetv_new ()
1.44 {
1.45 GMythLiveTV *livetv = GMYTH_LIVETV ( g_object_new( GMYTH_LIVETV_TYPE, NULL ) );
1.46 -
1.47 +
1.48 + livetv->mutex = g_mutex_new();
1.49 +
1.50 return livetv;
1.51 }
1.52
1.53 @@ -309,7 +320,7 @@
1.54 }
1.55 }
1.56
1.57 - g_static_mutex_lock( &lock );
1.58 + g_mutex_lock( livetv->mutex );
1.59
1.60 livetv->is_livetv = TRUE;
1.61
1.62 @@ -327,14 +338,10 @@
1.63 }
1.64
1.65 if ( gmyth_remote_util_get_free_recorder_count (livetv->socket) <= 0 ) {
1.66 - gmyth_debug ("No free remote encoder available. Trying to close the actual recording...");
1.67 + gmyth_debug ("No free remote encoder available.");
1.68
1.69 - //res = FALSE;
1.70 - //goto error;
1.71 - if ( livetv->recorder != NULL ) {
1.72 - g_object_unref( livetv->recorder );
1.73 - livetv->recorder = NULL;
1.74 - }
1.75 + res = FALSE;
1.76 + goto error;
1.77 }
1.78
1.79 /* Gets the recorder num */
1.80 @@ -445,8 +452,7 @@
1.81 /*
1.82 gmyth_debug( "Old ProgramInfo...\n" );
1.83 gmyth_program_info_print( livetv->proginfo );
1.84 - */
1.85 -
1.86 + */
1.87 /*
1.88 GMythProgramInfo* prog_inf = gmyth_recorder_get_next_program_info( livetv->recorder, BROWSE_DIRECTION_UP );
1.89
1.90 @@ -457,6 +463,7 @@
1.91 /* check if the program chain could be obtained from the MythTV protocol message */
1.92 if ( prog_info != NULL )
1.93 {
1.94 + g_debug( "Program Info: %s\n", gmyth_program_info_to_string( prog_info ) );
1.95 livetv->proginfo = prog_info;
1.96 /* testing change channel */
1.97 //gmyth_recorder_spawntv_no_tvchain( livetv->recorder );
1.98 @@ -488,7 +495,7 @@
1.99
1.100 livetv->uri = (GMythURI*)gmyth_backend_info_get_uri( backend_info );
1.101
1.102 - g_static_mutex_unlock( &lock );
1.103 + g_mutex_unlock( livetv->mutex );
1.104
1.105 if ( !gmyth_livetv_monitor_handler_start( livetv ) )
1.106 {
1.107 @@ -646,7 +653,7 @@
1.108 else
1.109 gmyth_debug( "URI path (from URI) = %s.\n", livetv->uri->uri->str );
1.110
1.111 - g_static_mutex_lock( &lock );
1.112 + g_mutex_lock( livetv->mutex );
1.113
1.114 if ( livetv->file_transfer != NULL )
1.115 {
1.116 @@ -686,7 +693,7 @@
1.117 goto done;
1.118 }
1.119
1.120 - g_static_mutex_unlock( &lock );
1.121 + g_mutex_unlock( livetv->mutex );
1.122
1.123 done:
1.124 /*
1.125 @@ -709,11 +716,11 @@
1.126
1.127 if (livetv->is_livetv) {
1.128 if ( !gmyth_recorder_stop_livetv (livetv->recorder) ) {
1.129 - g_warning ("[%s] Error while stoping remote encoder", __FUNCTION__);
1.130 + g_debug ("[%s] Error while stoping remote encoder", __FUNCTION__);
1.131 }
1.132
1.133 if ( !gmyth_recorder_finish_recording(livetv->recorder) ) {
1.134 - g_warning ("[%s] Error while finishing recording on remote encoder", __FUNCTION__);
1.135 + g_debug ("[%s] Error while finishing recording on remote encoder", __FUNCTION__);
1.136 }
1.137 }
1.138 }
2.1 --- a/gmyth/src/gmyth_livetv.h Tue Feb 13 23:15:54 2007 +0000
2.2 +++ b/gmyth/src/gmyth_livetv.h Tue Feb 13 23:17:35 2007 +0000
2.3 @@ -78,6 +78,8 @@
2.4
2.5 gboolean is_livetv;
2.6 gboolean setup_done;
2.7 +
2.8 + GMutex *mutex;
2.9
2.10 };
2.11
3.1 --- a/gmyth/src/gmyth_monitor_handler.c Tue Feb 13 23:15:54 2007 +0000
3.2 +++ b/gmyth/src/gmyth_monitor_handler.c Tue Feb 13 23:17:35 2007 +0000
3.3 @@ -70,8 +70,6 @@
3.4 #define GMYTHTV_ENABLE_DEBUG 1
3.5 #endif
3.6
3.7 -//GMainContext *io_watcher_context = NULL;
3.8 -
3.9 //GThread *monitor_th = NULL;
3.10
3.11 //static gboolean* myth_control_sock_listener( GIOChannel *io_channel );
3.12 @@ -84,7 +82,7 @@
3.13
3.14 static void gmyth_monitor_handler_default_listener( GMythMonitorHandler *monitor, gint msg_code, gchar* message );
3.15
3.16 -static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
3.17 +/* static GStaticMutex mutex = G_STATIC_MUTEX_INIT; */
3.18
3.19 //static GCond* io_watcher_cond = NULL;
3.20
3.21 @@ -146,9 +144,6 @@
3.22 /* it is used for signalizing the event socket consumer thread */
3.23 //io_watcher_cond = g_cond_new();
3.24
3.25 - /* mutex to control access to the event socket consumer thread */
3.26 - /*monitor->mutex = g_mutex_new();*/
3.27 -
3.28 monitor->monitor_th = NULL;
3.29
3.30 monitor->gmyth_monitor_handler_listener = gmyth_monitor_handler_listener;
3.31 @@ -163,6 +158,15 @@
3.32
3.33 monitor->allow_msgs_listener = FALSE;
3.34
3.35 + /*
3.36 + if ( monitor->mutex != NULL )
3.37 + {
3.38 + g_mutex_unlock( monitor->mutex );
3.39 + g_mutex_free( monitor->mutex );
3.40 + monitor->mutex = NULL;
3.41 + }
3.42 + */
3.43 +
3.44 if ( monitor->monitor_th != NULL )
3.45 {
3.46 g_thread_pool_free( monitor->monitor_th, TRUE, FALSE );
3.47 @@ -190,15 +194,7 @@
3.48 g_hash_table_destroy ( monitor->backend_msgs );
3.49 monitor->backend_msgs = NULL;
3.50 }
3.51 -
3.52 - /*
3.53 - if ( monitor->mutex != NULL )
3.54 - {
3.55 - g_mutex_free( monitor->mutex );
3.56 - monitor->mutex = NULL;
3.57 - }
3.58 - */
3.59 -
3.60 +
3.61 /*
3.62 if ( io_watcher_cond != NULL )
3.63 {
3.64 @@ -224,7 +220,10 @@
3.65 {
3.66 GMythMonitorHandler *monitor = GMYTH_MONITOR_HANDLER (
3.67 g_object_new ( GMYTH_MONITOR_HANDLER_TYPE, FALSE ) );
3.68 -
3.69 +
3.70 + /* mutex to control access to the event socket consumer thread */
3.71 + //monitor->mutex = g_mutex_new();
3.72 +
3.73 return monitor;
3.74 }
3.75
3.76 @@ -249,7 +248,7 @@
3.77 ret = FALSE;
3.78 */
3.79
3.80 - g_static_mutex_lock( &mutex );
3.81 + //g_mutex_lock( monitor->mutex );
3.82
3.83 return ret;
3.84
3.85 @@ -261,7 +260,7 @@
3.86
3.87 gboolean ret = TRUE;
3.88
3.89 - g_static_mutex_unlock( &mutex );
3.90 + //g_mutex_unlock( monitor->mutex );
3.91
3.92 //g_main_context_release( io_watcher_context );
3.93
3.94 @@ -283,7 +282,7 @@
3.95 monitor->allow_msgs_listener = FALSE;
3.96
3.97 #if 0
3.98 - if ( monitor->monitor_th != NULL )
3.99 + if ( monitor->monitor_th != NULL )
3.100 {
3.101 g_thread_pool_free( monitor->monitor_th, TRUE, FALSE );
3.102 //g_thread_exit( monitor->monitor_th );
3.103 @@ -320,7 +319,7 @@
3.104 /* configure the event socket */
3.105 //if ( NULL == monitor->event_sock ) {
3.106 if (!gmyth_connect_to_backend_monitor (monitor)) {
3.107 - g_printerr( "Connection to backend failed (Event Socket).\n" );
3.108 + gmyth_debug( "Connection to backend failed (Event Socket)." );
3.109 ret = FALSE;
3.110 }
3.111 else {
3.112 @@ -416,6 +415,12 @@
3.113
3.114 static guint count = 0;
3.115
3.116 + if ( ( io_cond & G_IO_HUP ) != 0 )
3.117 + {
3.118 + *ret = FALSE;
3.119 + goto clean_up;
3.120 + }
3.121 +
3.122 //GIOChannel *io_channel = monitor->event_sock->sd_io_ch;
3.123 //GIOCondition condition = g_io_channel_get_buffer_condition( io_channel );
3.124
3.125 @@ -482,14 +487,14 @@
3.126 g_object_unref( strlist );
3.127 strlist = NULL;
3.128 }
3.129 -
3.130 +
3.131 io_cond = g_io_channel_get_buffer_condition( io_channel );
3.132
3.133 - } while ( recv <= 0 /* && ( io_cond & G_IO_IN ) != 0 */);
3.134 + } while ( recv <= 0 && ( ( io_cond & G_IO_HUP ) == 0 ) );
3.135
3.136 gmyth_debug ("\tMONITOR EVENT: Read %d bytes\n", recv );
3.137
3.138 - g_usleep( 300 );
3.139 + //g_usleep( 300 );
3.140
3.141 } /* main GThread while */
3.142
4.1 --- a/gmyth/src/gmyth_monitor_handler.h Tue Feb 13 23:15:54 2007 +0000
4.2 +++ b/gmyth/src/gmyth_monitor_handler.h Tue Feb 13 23:17:35 2007 +0000
4.3 @@ -102,7 +102,7 @@
4.4 /* stores the messages coming from the backend */
4.5 GHashTable *backend_msgs;
4.6
4.7 - /*GMutex *mutex;*/
4.8 + //GMutex *mutex;
4.9
4.10 };
4.11
5.1 --- a/gmyth/src/gmyth_socket.c Tue Feb 13 23:15:54 2007 +0000
5.2 +++ b/gmyth/src/gmyth_socket.c Tue Feb 13 23:17:35 2007 +0000
5.3 @@ -1053,7 +1053,7 @@
5.4 * @return TRUE if command was sent, FALSE if any error happens.
5.5 */
5.6 gboolean
5.7 -gmyth_socket_write_stringlist(GMythSocket *gmyth_socket, GMythStringList* str_list)
5.8 +gmyth_socket_write_stringlist( GMythSocket *gmyth_socket, GMythStringList* str_list )
5.9 {
5.10
5.11 GList *tmp_list = NULL;