prg_mt_mutex_create()

Abstract

Creates a mutex object to serialize access to shared resources in a parallel environment.

Syntax

prg_mt_mutex_create (options, rank, description, result_ptr)
Argument Type Description
options int One of the following:
• PRGC_MT_MUTEX_NO_OPTIONS: base mutex
• PRGC_MT_MUTEX_RECURSIVE: recursive mutex
• PRGC_MT_MUTEX_READER_WRITER: reader/writer mutex potentially OR'ed (C's |) with PRGC_MT_MUTEX_RANK_CHECK: use rank info to prevent locks if badly ordered, PRGC_MT_MUTEX_LOCK_ID_TRACK: keep track of the process ID for error reporting
rank int rank of the mutex, ignored unless PRGC_MT_MUTEX_RANK_CHECK is part of the options
description const char * human-readable description used in error messages generated by the prg_mt package
result_ptr PrtT_Mutex_Result optional storage space for result value (no value is provided if this is set to PRGC_NIL)

Return Type

PrgT_Mutex *

Resulting mutex object, or PRGC_NIL if creation failed.

prg_mt.h

Details

This function allows you to create one of the mutex forms described in Package Overview. The resulting object should be used with prg_mt_mutex_lock() and prg_mt_mutex_unlock() to correctly access a shared resource.

Each shared resource should have its own mutex if possible.

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