Skip to content

Commit

Permalink
libc: arcmwdt: increase the number of preallocated locks
Browse files Browse the repository at this point in the history
Increase the number of locks to match what the ARC MWDT libc requires
now. The library wants to have 2 locks per each available FILE entry,
and then some more. Also do not include an internal libc header, as
all that is needed from that header is a simple typedef.

Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
  • Loading branch information
tagunil authored and kartben committed Dec 3, 2024
1 parent 0afae55 commit bedfa57
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/libc/arcmwdt/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,25 @@

#ifdef CONFIG_MULTITHREADING

#include <stdio.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/sys/mutex.h>
#include <zephyr/logging/log.h>
#include <../lib/src/c/inc/internal/thread.h>

#ifndef CONFIG_USERSPACE
#define ARCMWDT_DYN_LOCK_SZ (sizeof(struct k_mutex))
#define ARCMWDT_MAX_DYN_LOCKS 10
/* The library wants 2 locks per available FILE entry, and then some more */
#define ARCMWDT_MAX_DYN_LOCKS (FOPEN_MAX * 2 + 5)

K_MEM_SLAB_DEFINE(z_arcmwdt_lock_slab, ARCMWDT_DYN_LOCK_SZ, ARCMWDT_MAX_DYN_LOCKS, sizeof(void *));
#endif /* !CONFIG_USERSPACE */

LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);

typedef void *_lock_t;

void _mwmutex_create(_lock_t *mutex_ptr)
{
bool alloc_fail;
Expand Down

0 comments on commit bedfa57

Please sign in to comment.