各位高手,我想请教一个问题。
在VxWorks中的错误代码S_objLib_OBJ_UNAVAILABLE代表什么错误?
我使用VxWorks5.5.1,Zinc6.0开发软件。在使用taskSpawn发起主界面任务后,在shell下使用i命令查看各个任务的状态,发现我的主界面任务有错误码0x3d0002(S_objLib_OBJ_UNAVAILABLE),一直不知道是什么错误导致的。界面也能创建,各种响应正常。但是偶尔我的界面会死掉,死的时候只是在软件启动时刻,在操作过程中,从来没死过。现在查原因,不知道是不是由S_objLib_OBJ_UNAVAILABLE错误引起的。
------解决方案--------------------------------------------------------
像这种问题,只能通过记录日志的方式来解决问题?
S_objLib_OBJ_UNAVAILABLE:
- timeout is set to NO_WAIT, and the queue is full.
建议查看一下
VXWMsgQ::send( ) - send a message to message queue
SYNOPSIS
STATUS send
(
char * buffer,
UINT nBytes,
int timeout,
int pri
)
DESCRIPTION
This routine sends the message in buffer of length nBytes to its message queue. If any tasks are already waiting to receive messages on the queue, the message is immediately delivered to the first waiting task. If no task is waiting to receive messages, the message is saved in the message queue.
The timeout parameter specifies the number of ticks to wait for free space if the message queue is full. The timeout parameter can also have the following special values:
NO_WAIT
return immediately, even if the message has not been sent.
WAIT_FOREVER
never time out.
The pri parameter specifies the priority of the message being sent. The possible values are:
MSG_PRI_NORMAL
normal priority; add the message to the tail of the list of queued messages.
MSG_PRI_URGENT
urgent priority; add the message to the head of the list of queued messages.
USE BY INTERRUPT SERVICE ROUTINES
This routine can be called by interrupt service routines as well as by tasks. This is one of the primary means of communication between an interrupt service routine and a task. When called from an interrupt service routine, timeout must be NO_WAIT.
RETURNS
OK or ERROR.
ERRNO
S_objLib_OBJ_DELETED
- the message queue was deleted while waiting to a send message.
S_objLib_OBJ_UNAVAILABLE
- timeout is set to NO_WAIT, and the queue is full.
S_objLib_OBJ_TIMEOUT
- the queue is full for timeout ticks.
S_msgQLib_INVALID_MSG_LENGTH
- nBytes is larger than the maxMsgLength set for the message queue.
S_msgQLib_NON_ZERO_TIMEOUT_AT_INT_LEVEL
- called from an ISR, with timeout not set to NO_WAIT.
------解决方案--------------------------------------------------------
将程序中主要函数运行完毕后,将运行成功与否的结果写入到文件中,如果程序死掉后,可以通过查看此日志文件,就可以发现是程序死到那个函数上了!一般大一点的程序,必须要有此功能,因为一些细节问题,时隐时显!
另外,你可以百度搜一下 日志文件 等关健字