Skip to content

Commit bedfa57

Browse files
tagunilkartben
authored andcommitted
libc: arcmwdt: increase the number of preallocated locks
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 <[email protected]>
1 parent 0afae55 commit bedfa57

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/libc/arcmwdt/threading.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,25 @@
66

77
#ifdef CONFIG_MULTITHREADING
88

9+
#include <stdio.h>
910
#include <zephyr/init.h>
1011
#include <zephyr/kernel.h>
1112
#include <zephyr/sys/__assert.h>
1213
#include <zephyr/sys/mutex.h>
1314
#include <zephyr/logging/log.h>
14-
#include <../lib/src/c/inc/internal/thread.h>
1515

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

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

2324
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
2425

26+
typedef void *_lock_t;
27+
2528
void _mwmutex_create(_lock_t *mutex_ptr)
2629
{
2730
bool alloc_fail;

0 commit comments

Comments
 (0)