Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux驱动程序设置取消点_Linux_Kernel_Pthreads - Fatal编程技术网

Linux驱动程序设置取消点

Linux驱动程序设置取消点,linux,kernel,pthreads,Linux,Kernel,Pthreads,我正在为Linux编写一个简单的字符设备驱动程序,其中包含阻塞read()和write() 我要做的是将它们设置为取消点,以便在这些函数上挂起的线程上调用pthread_cancel将导致其终止 如何将它们设置为取消点 提前感谢。如果您正在编写内核驱动程序,那么您需要做的就是确保read()和write()正确地用作用户空间的取消点,以确保当进程在内核空间中等待时出现信号时,它们会立即返回(短项目计数或EINTR错误) 这通常意味着使用wait\u event\u interruptible()

我正在为Linux编写一个简单的字符设备驱动程序,其中包含阻塞read()和write()

我要做的是将它们设置为取消点,以便在这些函数上挂起的线程上调用pthread_cancel将导致其终止

如何将它们设置为取消点


提前感谢。

如果您正在编写内核驱动程序,那么您需要做的就是确保
read()
write()
正确地用作用户空间的取消点,以确保当进程在内核空间中等待时出现信号时,它们会立即返回(短项目计数或
EINTR
错误)

这通常意味着使用
wait\u event\u interruptible()
,然后检查
if(signal\u pending(current))