op_prg_mt_mutex_unlock()

Abstract

Unlocks a specified mutex.

Syntax

op_prg_mt_mutex_unlock (mutex_ptr)
Argument Type Description
mutex_ptr PrgT_Mutex Mutex to be unlocked.

Return Type

Compcode

OPC_COMPCODE_SUCCESS if the mutex could be unlocked; OPC_COMPCODE_FAILURE otherwise.

Example

/* Evaluate reliability of beacons that are transmitted on the channel   */
/* currently used by the receiver (i.e. if the initial status is VALID). */

if (rx_state_ptr->roaming_info_ptr->enable_roaming &&
	chanmatch_status == OPC_TDA_RA_MATCH_VALID)
	{
	op_pk_nfd_access (pkptr, "Type", &rcvd_frame_type);
	if (rcvd_frame_type == WlanC_Beac)
		{
		/* Serialize the execution of AP reliability evaluation, because the     */
		/* MAC of the receiver might be reading or writing the same information. */
		op_prg_mt_mutex_lock (rx_state_ptr->roaming_info_ptr->roam_info_mutex, 0);
		wlan_ap_reliability_eval (pkptr, OPC_FALSE, rx_state_ptr->roaming_info_ptr);
		op_prg_mt_mutex_unlock (rx_state_ptr->roaming_info_ptr->roam_info_mutex);
		}
	}

Details

When a thread of code has successfully locked a mutex, it prevents all other threads from locking that mutex until it unlocks the mutex.

A thread of code trying to unlock a mutex it hasn’t previously locked will not affect the state of the mutex.

If the mutex was created with the option OPC_MT_MUTEX_RECURSIVE, the mutex will not be unlocked until as many successful calls to op_prg_mt_mutex_unlock() have been made by the thread as the number of successful op_prg_mt_mutex_lock() calls made by that same thread.

Purpose

Provides a way to unlock a specific mutex that had been previously locked by the same thread of code.

Errors

  • Recoverable Error: Null mutex pointer
  • Recoverable Error: Mutex (<description>) is not locked by this thread

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com