Hi,
On 9/29/20 11:26 AM, Harald Welte wrote:
So what I think would be good is:
* If the write_queue is empty, attempt a synchronous, non-blocking write
to stderr/file.
* Only if that write returns short (in the extreme case '0'), enqueue the
[remainder of the] log message to the write_queue for delayed storage.
Fine with this approach, I was going to suggest that too while reading
your last comments. The important point here is changing the fd to be
non-blocking, all the rest is basically about how to keep ordering and
delays at minimum once we hit a would-block situation.
In any case, I'd gor for: when pushing stuff to the fd from the queue,
also push until short-write is hit, not only 1 msgb per select().
This way we should get the best of both worlds: More
or less unmodified
behavior for 99% of all cases, while avoiding any delays in those few
situations where right now we are stalling/blocking due to a full stdio buffer.
ACK.
--
- Pau Espin Pedrol <pespin(a)sysmocom.de>
http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Director: Harald Welte