I am trying to find a proper way of closing/cancelling the file descriptor ( fd
) in VxWorks. As shown in the example, I have a task that does read operation forever, and I have a second task that will close the fd
. In my system, FIOCANCEL
is not supported, so I need to find an alternative way. So I am wondering if anyone have some ideas of how I can properly close the fd
from the second task?
//Task 1
while (1)
{
if (running == false)
break;
ret = read(fd, buf, size);
}
// Task 2
running = false;
/* ioctl(fd, FIOCANCEL, 0); (not supported)*/
close(fd);
Probably this is just a small programming error. The close()
should work fine. You should just set the running
-variable in task 2 to false
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.