prg_mt_mutex_lock()

Abstract

Attempts to lock a mutex.

Syntax

prg_mt_mutex_lock (mutex_ptr, option, rank_ptr, description, lock_id)
Argument Type Description
mutex_ptr PrgT_Mutex * Mutex object to lock.
option int If the mutex is a reader/writer mutex, this should be one of PRGC_MT_MUTEX_LOCK_READER PRGC_MT_MUTEX_LOCK_WRITER, otherwise ignored
rank_ptr int * If mutex is set to check for ranks, this will be filled with the lowest ranked mutex for the process if the lock attempt failed. If set to PRGC_NIL, no rank value will be stored.
description char * If the mutex lock attempt failed, this will be a copy of the description of the lowest ranked mutex locked by the process. The argument should be a char array big enough to store any description. If set to PRGC_NIL, no description will be copied.
lock_id int ID of the locking process (arbitrary value specified by caller)

Return Type

PrgT_Mutex_Result

Success or failure code; one of the values in Table 6 Mutex Package Symbolic Constants.

prg_mt.h

Details

This function attempts to lock the specified mutex object. If the mutex is already locked in such a way that it can't be shared (e.g., not recursive or not reader locked of reader/writer) the calling process will be blocked until the mutex is unlocked and available. Processes that are blocked waiting for a mutex to be available are blocked and released in the order in which they requested the lock.

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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