envlock.c
来自「用于嵌入式Linux系统的标准C的库函数」· C语言 代码 · 共 52 行
C
52 行
/*FUNCTION<<__env_lock>>, <<__env_unlock>>--lock environ variableINDEX __env_lockINDEX __env_unlockANSI_SYNOPSIS #include "envlock.h" void __env_lock (struct _reent *<[reent]>); void __env_unlock (struct _reent *<[reent]>);TRAD_SYNOPSIS void __env_lock(<[reent]>) struct _reent *<[reent]>; void __env_unlock(<[reent]>) struct _reent *<[reent]>;DESCRIPTIONThe <<setenv>> family of routines call these functions when they needto modify the environ variable. The version of these routines suppliedin the library does not do anything. If multiple threads of executioncan call <<setenv>>, or if <<setenv>> can be called reentrantly, thenyou need to define your own versions of these functions in order tosafely lock the memory pool during a call. If you do not, the memorypool may become corrupted.A call to <<setenv>> may call <<__env_lock>> recursively; that is,the sequence of calls may go <<__env_lock>>, <<__env_lock>>,<<__env_unlock>>, <<__env_unlock>>. Any implementation of theseroutines must be careful to avoid causing a thread to wait for a lockthat it already holds.*/#include "envlock.h"void__env_lock (ptr) struct _reent *ptr;{}void__env_unlock (ptr) struct _reent *ptr;{}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?