Browse Source

logging: fix log buffer pending while it is definitely full

The buffer flags MPSC_PBUF_FULL is a shared resource to determine
whether the buffer is available. When processing drop messages,
the flag will be cleared first and then set, add spin lock protection.

Signed-off-by: Xiaolu Sun <xiaolu.sun@intel.com>
pull/74918/merge
Xiaolu Sun 11 months ago committed by Anas Nashif
parent
commit
45705a84ab
  1. 2
      lib/os/mpsc_pbuf.c

2
lib/os/mpsc_pbuf.c

@ -611,8 +611,10 @@ void mpsc_pbuf_free(struct mpsc_pbuf_buffer *buffer, @@ -611,8 +611,10 @@ void mpsc_pbuf_free(struct mpsc_pbuf_buffer *buffer,
bool mpsc_pbuf_is_pending(struct mpsc_pbuf_buffer *buffer)
{
uint32_t a;
k_spinlock_key_t key = k_spin_lock(&buffer->lock);
(void)available(buffer, &a);
k_spin_unlock(&buffer->lock, key);
return a ? true : false;
}

Loading…
Cancel
Save