Skip to content
Commit c6942f61 authored by Frank Benkert's avatar Frank Benkert Committed by Gregory Nutt
Browse files

drivers/serial/serial.c: Optimize wait time in tcdram() for buffer emptying

According to the specification, the close function must wait until all data
has been written before it closes the file (except O_NONBLOCK is set). The
maximum waiting time for this is not specified.

To be able to edit the file list of the process, the close function has to lock
the file list semaphore. After that the close function of the serial driver is
called.

Waiting for the complete transmission of all data is done in the serial driver.
This causes the semaphore to remain locked until all data has been sent.
However, no other thread of the process can edit the file list for that time
(open, close, dup2, etc.). This is not optimal in a multithreaded environment.
Therefore, we have to keep the waiting time within the driver as short as possible.
parent 2dbe7af7
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment