mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-16 01:05:15 +08:00
1 file changed
+9
-1
@@ -117,9 +117,17 @@ static int serial_fops_close(struct dfs_file *fd)
|
||||
|
||||
device = (rt_device_t)fd->vnode->data;
|
||||
|
||||
rt_device_set_rx_indicate(device, RT_NULL);
|
||||
/* close this file descriptor, but only drop the rx indication callback when
|
||||
* the device is really released. The callback wakes readers (see
|
||||
* serial_fops_rx_ind), so clearing it while another user still holds the
|
||||
* device would make that user stop receiving input. */
|
||||
rt_device_close(device);
|
||||
|
||||
if (device->ref_count == 0)
|
||||
{
|
||||
rt_device_set_rx_indicate(device, RT_NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user