_locking函数的未记录错误? [英] Undocumented error on _locking function?

查看:72
本文介绍了_locking函数的未记录错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在Visual Studio 2013中调用CRT _locking函数时收到错误。

I am getting an error in a call to the CRT _locking function in Visual Studio 2013.


根据MSDN,_locking如果成功则返回0。返回值-1表示失败,在这种情况下,errno设置为以下值之一:  EACCES  (锁定违规), EBADF  (无效的
文件描述符),  EDEADLOCK  (锁定违规)或  EINVAL  (无效的参数)。

According to MSDN, _locking returns 0 if successful. A return value of –1 indicates failure, in which case errno is set to one of the following values: EACCES (Locking violation), EBADF (Invalid file descriptor), EDEADLOCK (Locking violation) or EINVAL (Invalid argument).


但是,在-1返回后,errno设置为  ENOENT  错误(没有这样的文件或目录。)

However, after a -1 return, errno is set to ENOENT error (No such file or directory).


错误是间接的,99.99%的时间很好。

Error is intermitent, and 99.99% of time works fine.


有谁知道这个错误可能来自哪里?

Does anyone know where this error may come from?

推荐答案

您好
Galaxian.11,

感谢您在此处发布。

>>然而,之后a -1 return,errno设置为  ENOENT 错误(没有这样的文件或目录)。

该文件还说:

"如果失败是由于错误的参数引起的,例如无效的文件描述符,则调用无效的参数处理程序"

"If the failure is due to a bad parameter, such as an invalid file descriptor, the invalid parameter handler is invoked"

所以你应该检查文件描述符参数发生此错误时,请写一些日志以查看此参数是否无效。

So you should check the File descriptor parameter when you got this error. Or write some log to see if this parameter is invalid when this error occurs.

希望这可以为您提供帮助。

Hope this could be help of you.

最诚挚的问候,

Sera Yu


这篇关于_locking函数的未记录错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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