[maemo-commits] [maemo-commits] r15010 - in projects/haf/trunk/libosso: debian src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Jan 8 16:57:12 EET 2008
- Previous message: [maemo-commits] r15009 - in projects/haf/trunk/libosso: debian src
- Next message: [maemo-commits] r15011 - projects/haf/trunk/libosso/src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: kihamala Date: 2008-01-08 16:57:11 +0200 (Tue, 08 Jan 2008) New Revision: 15010 Modified: projects/haf/trunk/libosso/debian/changelog projects/haf/trunk/libosso/src/osso-cp-plugin.c projects/haf/trunk/libosso/src/osso-hw.c projects/haf/trunk/libosso/src/osso-init.c projects/haf/trunk/libosso/src/osso-internal.h projects/haf/trunk/libosso/src/osso-rpc.c Log: removed mutex code Modified: projects/haf/trunk/libosso/debian/changelog =================================================================== --- projects/haf/trunk/libosso/debian/changelog 2008-01-08 14:26:46 UTC (rev 15009) +++ projects/haf/trunk/libosso/debian/changelog 2008-01-08 14:57:11 UTC (rev 15010) @@ -1,6 +1,7 @@ libosso (2.16-1~unreleased) unstable; urgency=low * Added fix for missing startup notification (NB#55837). + * Removed the mutex code -- too risky for Diablo. -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> Tue, 8 Jan 2008 16:21:44 +0200 Modified: projects/haf/trunk/libosso/src/osso-cp-plugin.c =================================================================== --- projects/haf/trunk/libosso/src/osso-cp-plugin.c 2008-01-08 14:26:46 UTC (rev 15009) +++ projects/haf/trunk/libosso/src/osso-cp-plugin.c 2008-01-08 14:57:11 UTC (rev 15010) @@ -95,16 +95,11 @@ return NULL; } - LOCK_OR_RETURN(osso->mutex, NULL); - if (osso->cp_plugins) handle = g_hash_table_lookup (osso->cp_plugins, libname); if (handle) - { - pthread_mutex_unlock (&osso->mutex); - return handle; - } + return handle; handle = dlopen (libname, RTLD_LAZY | RTLD_LOCAL); if (handle == NULL) @@ -113,7 +108,6 @@ } g_hash_table_insert (osso->cp_plugins, g_strdup (libname), handle); - pthread_mutex_unlock (&osso->mutex); return handle; } @@ -213,12 +207,9 @@ return OSSO_OK; } - LOCK_OR_RETURN(osso->mutex, OSSO_ERROR); - if (osso->cp_plugins) handle = g_hash_table_lookup(osso->cp_plugins, filename); - pthread_mutex_unlock (&osso->mutex); if (handle) { osso_return_t ret; osso_cp_plugin_save_state_f *ss = NULL; Modified: projects/haf/trunk/libosso/src/osso-hw.c =================================================================== --- projects/haf/trunk/libosso/src/osso-hw.c 2008-01-08 14:26:46 UTC (rev 15009) +++ projects/haf/trunk/libosso/src/osso-hw.c 2008-01-08 14:57:11 UTC (rev 15010) @@ -155,8 +155,6 @@ dbus_error_init(&error); - LOCK_OR_RETURN(osso->mutex, OSSO_ERROR); - if (state->shutdown_ind) { osso->hw_cbs.shutdown_ind.cb = cb; osso->hw_cbs.shutdown_ind.data = data; @@ -165,7 +163,6 @@ dbus_bus_add_match(osso->sys_conn, "type='signal',interface='" MCE_SIGNAL_IF "',member='" MCE_SHUTDOWN_SIG "'", &error); if (dbus_error_is_set(&error)) { - pthread_mutex_unlock(&osso->mutex); ULOG_ERR_F("dbus_bus_add_match failed: %s", error.message); dbus_error_free(&error); return OSSO_ERROR; @@ -184,7 +181,6 @@ dbus_bus_add_match(osso->sys_conn, "type='signal',interface='" USER_LOWMEM_OFF_SIGNAL_IF "'", &error); if (dbus_error_is_set(&error)) { - pthread_mutex_unlock(&osso->mutex); ULOG_ERR_F("dbus_bus_add_match failed: %s", error.message); dbus_error_free(&error); return OSSO_ERROR; @@ -192,12 +188,10 @@ dbus_bus_add_match(osso->sys_conn, "type='signal',interface='" USER_LOWMEM_ON_SIGNAL_IF "'", &error); if (dbus_error_is_set(&error)) { - pthread_mutex_unlock(&osso->mutex); ULOG_ERR_F("dbus_bus_add_match failed: %s", error.message); dbus_error_free(&error); return OSSO_ERROR; } - pthread_mutex_unlock(&osso->mutex); _msg_handler_set_cb_f(osso, USER_LOWMEM_OFF_SIGNAL_SVC, USER_LOWMEM_OFF_SIGNAL_OP, USER_LOWMEM_OFF_SIGNAL_IF, @@ -206,7 +200,6 @@ USER_LOWMEM_ON_SIGNAL_OP, USER_LOWMEM_ON_SIGNAL_IF, lowmem_signal_handler, NULL, FALSE); - LOCK_OR_RETURN(osso->mutex, OSSO_ERROR); } osso->hw_cbs.memory_low_ind.set = TRUE; @@ -220,7 +213,6 @@ dbus_bus_add_match(osso->sys_conn, "type='signal',interface='" MCE_SIGNAL_IF "',member='" MCE_DATA_SAVE_SIG "'", &error); if (dbus_error_is_set(&error)) { - pthread_mutex_unlock(&osso->mutex); ULOG_ERR_F("dbus_bus_add_match failed: %s", error.message); dbus_error_free(&error); return OSSO_ERROR; @@ -238,7 +230,6 @@ dbus_bus_add_match(osso->sys_conn, "type='signal',interface='" MCE_SIGNAL_IF "',member='" MCE_INACTIVITY_SIG "'", &error); if (dbus_error_is_set(&error)) { - pthread_mutex_unlock(&osso->mutex); ULOG_ERR_F("dbus_bus_add_match failed: %s", error.message); dbus_error_free(&error); return OSSO_ERROR; @@ -257,7 +248,6 @@ dbus_bus_add_match(osso->sys_conn, "type='signal',interface='" MCE_SIGNAL_IF "',member='" MCE_DEVICE_MODE_SIG "'", &error); if (dbus_error_is_set(&error)) { - pthread_mutex_unlock(&osso->mutex); ULOG_ERR_F("dbus_bus_add_match failed: %s", error.message); dbus_error_free(&error); return OSSO_ERROR; @@ -269,7 +259,6 @@ } osso->hw_cbs.sig_device_mode_ind.set = TRUE; } - pthread_mutex_unlock(&osso->mutex); if (install_mce_handler) { _msg_handler_set_cb_f(osso, @@ -312,8 +301,6 @@ state = (osso_hw_state_t*) &default_mask; } - LOCK_OR_RETURN(osso->mutex, OSSO_ERROR); - _unset_state_cb(shutdown_ind); if (state->memory_low_ind && osso->hw_cbs.memory_low_ind.set) { osso->hw_cbs.memory_low_ind.cb = NULL; @@ -323,8 +310,6 @@ USER_LOWMEM_OFF_SIGNAL_IF "'", NULL); dbus_bus_remove_match(osso->sys_conn, "type='signal',interface='" USER_LOWMEM_ON_SIGNAL_IF "'", NULL); - - pthread_mutex_unlock(&osso->mutex); _msg_handler_rm_cb_f(osso, USER_LOWMEM_OFF_SIGNAL_SVC, USER_LOWMEM_OFF_SIGNAL_OP, USER_LOWMEM_OFF_SIGNAL_IF, @@ -335,20 +320,17 @@ USER_LOWMEM_ON_SIGNAL_IF, (const _osso_handler_f*)lowmem_signal_handler, NULL, FALSE); - LOCK_OR_RETURN(osso->mutex, OSSO_ERROR); } _unset_state_cb(save_unsaved_data_ind); _unset_state_cb(system_inactivity_ind); _unset_state_cb(sig_device_mode_ind); if (_state_is_unset()) { - pthread_mutex_unlock(&osso->mutex); _msg_handler_rm_cb_f(osso, MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF, (const _osso_handler_f*)signal_handler, NULL, FALSE); } - pthread_mutex_unlock(&osso->mutex); return OSSO_OK; } Modified: projects/haf/trunk/libosso/src/osso-init.c =================================================================== --- projects/haf/trunk/libosso/src/osso-init.c 2008-01-08 14:26:46 UTC (rev 15009) +++ projects/haf/trunk/libosso/src/osso-init.c 2008-01-08 14:57:11 UTC (rev 15010) @@ -321,7 +321,6 @@ static osso_context_t *_init(const gchar *application, const gchar *version) { osso_context_t *osso; - pthread_mutexattr_t mutex_attr; if (!_validate(application, version)) { ULOG_ERR_F("invalid arguments"); @@ -355,10 +354,6 @@ osso->cp_plugins = g_hash_table_new(g_str_hash, g_str_equal); osso->rpc_timeout = -1; osso->next_handler_id = 1; - - pthread_mutexattr_init(&mutex_attr); - pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_ERRORCHECK_NP); - pthread_mutex_init(&osso->mutex, &mutex_attr); return osso; } @@ -366,7 +361,6 @@ const char *version) { osso_context_t *osso; - pthread_mutexattr_t mutex_attr; if (!_validate(application, version)) { ULOG_ERR_F("invalid arguments"); @@ -397,10 +391,6 @@ osso->cp_plugins = g_hash_table_new(g_str_hash, g_str_equal); osso->rpc_timeout = -1; osso->next_handler_id = 1; - - pthread_mutexattr_init(&mutex_attr); - pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_ERRORCHECK_NP); - pthread_mutex_init(&osso->mutex, &mutex_attr); return osso; } @@ -411,9 +401,6 @@ if (osso == NULL) { return; } - - LOCK_OR_RETURN(osso->mutex, ); - if (osso->uniq_hash != NULL) { g_hash_table_destroy(osso->uniq_hash); } @@ -429,14 +416,11 @@ if (osso->cp_plugins != NULL) { g_hash_table_destroy(osso->cp_plugins); } - + #ifdef LIBOSSO_DEBUG g_log_remove_handler(NULL, osso->log_handler); osso->log_handler = 0; #endif - pthread_mutex_unlock(&osso->mutex); - pthread_mutex_destroy(&osso->mutex); - memset(osso, 0, sizeof(osso_context_t)); free(osso); osso = NULL; @@ -621,9 +605,6 @@ } ULOG_DEBUG_F("key = '%s'", interface); - - LOCK_OR_RETURN(osso->mutex, DBUS_HANDLER_RESULT_NOT_YET_HANDLED); - elem = g_hash_table_lookup(osso->if_hash, interface); if (elem != NULL) { @@ -641,10 +622,8 @@ ULOG_DEBUG_F("before calling the handler"); ULOG_DEBUG_F(" handler = %p", handler->handler); ULOG_DEBUG_F(" data = %p", handler->data); - (*handler->handler)(osso, msg, handler->data, 0); ULOG_DEBUG_F("after calling the handler"); - #ifdef OSSOLOG_COMPILE found = TRUE; #endif @@ -653,7 +632,6 @@ list = g_slist_next(list); } } - pthread_mutex_unlock(&osso->mutex); #ifdef OSSOLOG_COMPILE if (!found) { ULOG_DEBUG_F("suitable handler not found from the hash table"); @@ -828,9 +806,6 @@ } reply_to = dbus_message_get_reply_serial(msg); - LOCK_OR_RETURN(muali->mutex, DBUS_HANDLER_RESULT_NOT_YET_HANDLED); - - muali->cur_conn = conn; elem_list = opm_match(muali, dbus_message_get_path(msg), dbus_message_get_member(msg)); @@ -946,7 +921,6 @@ elem_list_p = g_slist_next(elem_list_p); } - pthread_mutex_unlock(&muali->mutex); if (elem_list != NULL) { g_slist_free(elem_list); @@ -1077,8 +1051,6 @@ handler->can_free_data = can_free_data; handler->handler_id = osso->next_handler_id++; - LOCK_OR_RETURN(osso->mutex, 0); - /* warn about the old element if it exists */ old = g_hash_table_lookup(osso->uniq_hash, uniq_key); if (old != NULL) { @@ -1098,7 +1070,6 @@ /* we need to allocate a new hash table element */ new_elem = calloc(1, sizeof(_osso_hash_value_t)); if (new_elem == NULL) { - pthread_mutex_unlock(&osso->mutex); ULOG_ERR_F("calloc() failed"); free(handler); return 0; @@ -1106,7 +1077,6 @@ new_key = strdup(uniq_key); if (new_key == NULL) { - pthread_mutex_unlock(&osso->mutex); ULOG_ERR_F("strdup() failed"); free(handler); free(new_elem); @@ -1119,10 +1089,8 @@ } if (add_to_if_hash(osso, handler, interface)) { - pthread_mutex_unlock(&osso->mutex); return handler->handler_id; } else { - pthread_mutex_unlock(&osso->mutex); return 0; } } @@ -1175,8 +1143,6 @@ elem->call_once_per_handler_id = call_once_per_handler_id; /* other members are not used and left zero */ - LOCK_OR_RETURN(context->mutex, FALSE); - old = g_hash_table_lookup(context->id_hash, GINT_TO_POINTER(handler_id)); if (old != NULL) { ULOG_DEBUG_F("registering another handler for id %d", handler_id); @@ -1192,7 +1158,6 @@ /* we need to allocate a new hash table element */ new_elem = calloc(1, sizeof(_osso_hash_value_t)); if (new_elem == NULL) { - pthread_mutex_unlock(&context->mutex); ULOG_ERR_F("calloc() failed"); free(elem); return FALSE; @@ -1204,9 +1169,7 @@ new_elem); } - ret = add_to_opm_hash(context, elem, opm_key); - pthread_mutex_unlock(&context->mutex); - return ret; + return add_to_opm_hash(context, elem, opm_key); } static void remove_from_opm_hash(_muali_context_t *context, @@ -1250,12 +1213,8 @@ GSList *list; ULOG_DEBUG_F("context=%p", context); - - LOCK_OR_RETURN(context->mutex, FALSE); - elem = g_hash_table_lookup(context->id_hash, GINT_TO_POINTER(handler_id)); if (elem == NULL) { - pthread_mutex_unlock(&context->mutex); ULOG_ERR_F("couldn't find handler_id %d from id_hash", handler_id); return FALSE; } @@ -1314,7 +1273,6 @@ ULOG_ERR_F("couldn't find handler_id %d from id_hash", handler_id); assert(0); /* this is a bug */ } - pthread_mutex_unlock(&context->mutex); return TRUE; } @@ -1378,8 +1336,6 @@ compose_hash_key(service, object_path, interface, uniq_key); - LOCK_OR_RETURN(osso->mutex, FALSE); - elem = g_hash_table_lookup(osso->uniq_hash, uniq_key); if (elem != NULL) { GSList *list; @@ -1431,14 +1387,12 @@ if (g_slist_length(elem->handlers) == 0) { g_hash_table_remove(osso->if_hash, interface); } - pthread_mutex_unlock(&osso->mutex); return TRUE; } list = g_slist_next(list); } } } - pthread_mutex_unlock(&osso->mutex); #if 0 for(i = 0; i < osso->ifs->len; i++) { Modified: projects/haf/trunk/libosso/src/osso-internal.h =================================================================== --- projects/haf/trunk/libosso/src/osso-internal.h 2008-01-08 14:26:46 UTC (rev 15009) +++ projects/haf/trunk/libosso/src/osso-internal.h 2008-01-08 14:57:11 UTC (rev 15010) @@ -36,8 +36,6 @@ # include <stdarg.h> # include <string.h> # include <malloc.h> -# include <pthread.h> -# include <errno.h> # include "libosso.h" # include "osso-log.h" @@ -82,14 +80,6 @@ #define MUALI_MAX_ARGS 256 #define MUALI_MAX_MATCH_SIZE 256 -#define LOCK_OR_RETURN(V, R) \ - if (pthread_mutex_lock(&V) == EDEADLK) { \ - ULOG_ERR_F("mutex deadlock detected"); \ - g_critical("mutex deadlock detected"); \ - return R; \ - } - - typedef struct { osso_hw_cb_f *cb; gpointer data; @@ -180,7 +170,6 @@ context */ const DBusMessage *reply_dummy, *error_dummy; gboolean muali_filters_setup; - pthread_mutex_t mutex; } _osso_af_context_t, _muali_context_t; typedef struct _muali_context_t { @@ -211,7 +200,6 @@ context */ const DBusMessage *reply_dummy, *error_dummy; gboolean muali_filters_setup; - pthread_mutex_t mutex; } _muali_this_type_is_not_used_t; # ifdef LIBOSSO_DEBUG Modified: projects/haf/trunk/libosso/src/osso-rpc.c =================================================================== --- projects/haf/trunk/libosso/src/osso-rpc.c 2008-01-08 14:26:46 UTC (rev 15009) +++ projects/haf/trunk/libosso/src/osso-rpc.c 2008-01-08 14:57:11 UTC (rev 15010) @@ -517,8 +517,6 @@ return OSSO_ERROR; } - LOCK_OR_RETURN(osso->mutex, OSSO_ERROR); - if (strcmp(service, osso->service) != 0 || (use_system_bus && !osso->systembus_service_registered) || (!use_system_bus && !osso->sessionbus_service_registered)) { @@ -537,12 +535,10 @@ } else if (ret == DBUS_REQUEST_NAME_REPLY_IN_QUEUE || ret == DBUS_REQUEST_NAME_REPLY_EXISTS) { /* this should be impossible */ - pthread_mutex_unlock(&osso->mutex); ULOG_ERR_F("dbus_bus_request_name is broken"); free(rpc); return OSSO_ERROR; } else if (ret == -1) { - pthread_mutex_unlock(&osso->mutex); ULOG_ERR_F("dbus_bus_request_name for '%s' failed: %s", service, err.message); dbus_error_free(&err); @@ -558,7 +554,6 @@ } } } - pthread_mutex_unlock(&osso->mutex); rpc->user_cb = cb; rpc->user_data = data;
- Previous message: [maemo-commits] r15009 - in projects/haf/trunk/libosso: debian src
- Next message: [maemo-commits] r15011 - projects/haf/trunk/libosso/src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]