- **Version**:  --> 4.5
- **Milestone**: 4.7.FC --> 4.5.2


---

** [tickets:#1338] mds : Optimized the mds_library_mutex locks for better core 
readability**

**Status:** fixed
**Milestone:** 4.5.2
**Created:** Fri Apr 24, 2015 05:16 AM UTC by A V Mahesh (AVM)
**Last Updated:** Mon Sep 14, 2015 07:01 AM UTC
**Owner:** A V Mahesh (AVM)


Now  in mds code mds_library_mutex  unlock/lock was taken before and after 
function
mds_mcm_time_wait() , and this is done acroos the code , if we move this
mds_library_mutex  unlock/lock  in side the fucntion mds_mcm_time_wait() , code 
will have more readability and   some code cleanup.

Example changes :

@@ -2435,9 +2438,7 @@ static uint32_t mcm_pvt_normal_svc_sndrs
                     fr_svc_id, to_svc_id, to_dest);
                return status;
        } else {
-               osaf_mutex_unlock_ordie(&gl_mds_library_mutex);
                if (NCSCC_RC_SUCCESS != mds_mcm_time_wait(&sync_queue->sel_obj, 
req->info.sndrsp.i_time_to_wait)) {
-                       osaf_mutex_lock_ordie(&gl_mds_library_mutex);
                        /* This is for response for local dest */
                        if (sync_queue->status == NCSCC_RC_SUCCESS) {
                                /* sucess case */
@@ -2458,7 +2459,6 @@ static uint32_t mcm_pvt_normal_svc_sndrs
                        mcm_pvt_del_sync_send_entry((MDS_PWE_HDL)env_hdl, 
fr_svc_id, xch_id, req->i_sendtype, 0);
                        return NCSCC_RC_REQ_TIMOUT;
                } else {
-                       osaf_mutex_lock_ordie(&gl_mds_library_mutex);
 
                        if (NCSCC_RC_SUCCESS != 
mds_check_for_mds_existence(&sync_queue->sel_obj, env_hdl, fr_svc_id, 
to_svc_id)) {
                                m_MDS_LOG_INFO("MDS_SND_RCV: MDS entry doesnt 
exist\n");
@@ -2549,15 +2549,18 @@ static uint32_t mds_await_active_tbl_del
 
 static uint32_t mds_mcm_time_wait(NCS_SEL_OBJ *sel_obj, uint32_t time_val)
 {
+       osaf_mutex_unlock_ordie(&gl_mds_library_mutex);
        /* Now wait for the response to come */
        int count = osaf_poll_one_fd(sel_obj->rmv_obj,
                time_val == 0 ? -1 : (time_val * 10));
 
+       osaf_mutex_lock_ordie(&gl_mds_library_mutex);


---

Sent from sourceforge.net because opensaf-tickets@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
_______________________________________________
Opensaf-tickets mailing list
Opensaf-tickets@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to