建议的做法在C,C重入code ++ [英] Recommended practices for re-entrant code in C, C++

查看:110
本文介绍了建议的做法在C,C重入code ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要通过 上重入指南写重入code时,推荐的做法。

I was going through a re-entrancy guide on recommended practices when writing re-entrant code.

还有什么其他参考资料和资源涵盖这个主题?

What other references and resources cover this topic?

皮棉什么样的工具可以用来检查这些问题?

What lint-like tools can be used to check for these issues?

推荐答案

该指南就足够了。

我个人的拇指规则只有2重新重新输入code:

My personal rule of thumbs are only 2 for re-reentering code:


  1. 只需按值参数,仅用于传递作为函数的参数值传递。

  1. take only pass by value parameters, used only value passed in as parameters in the function.

如果我需要使用任何全局参数或指针(性能或存储的缘故),使用互斥或​​信号来控制访问。

if I need to use any global parameters or pointer (for performance or storage sake), use a mutex or semaphore to control access to it.

这篇关于建议的做法在C,C重入code ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆