Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
test_mslab_threadsafe.c File Reference
#include <zephyr/ztest.h>
#include <zephyr/sys/atomic.h>

Macros

#define LOOP   10
 
#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define THREAD_NUM   4
 
#define SLAB_NUM   2
 
#define TIMEOUT   K_MSEC(200)
 
#define BLK_NUM   3
 
#define BLK_ALIGN   8
 
#define BLK_SIZE1   16
 
#define BLK_SIZE2   8
 
#define SLAB_BLOCKS   (THREAD_NUM * (BLK_NUM - 1) + 1)
 

Functions

 K_MEM_SLAB_DEFINE (mslab1, 16,(4 *(3 - 1)+1), 8)
 
static K_THREAD_STACK_ARRAY_DEFINE (tstack, 4,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static void tmslab_api (void *p1, void *p2, void *p3)
 
 ZTEST (mslab_threadsafe, test_mslab_threadsafe)
 Verify alloc and free from multiple equal priority threads.
 

Variables

static struct k_mem_slab mslab2 * slabs [2] = { &mslab1, &mslab2 }
 
static struct k_thread tdata [4]
 
static char tslab [8 *(4 *(3 - 1)+1)]
 
static atomic_t slab_id
 
static volatile bool success [4]
 

Macro Definition Documentation

◆ BLK_ALIGN

#define BLK_ALIGN   8

◆ BLK_NUM

#define BLK_NUM   3

◆ BLK_SIZE1

#define BLK_SIZE1   16

◆ BLK_SIZE2

#define BLK_SIZE2   8

◆ LOOP

#define LOOP   10

◆ SLAB_BLOCKS

#define SLAB_BLOCKS   (THREAD_NUM * (BLK_NUM - 1) + 1)

◆ SLAB_NUM

#define SLAB_NUM   2

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)

◆ THREAD_NUM

#define THREAD_NUM   4

◆ TIMEOUT

#define TIMEOUT   K_MSEC(200)

Function Documentation

◆ K_MEM_SLAB_DEFINE()

K_MEM_SLAB_DEFINE ( mslab1  ,
16  ,
(4 *(3 - 1)+1)  ,
 
)

◆ K_THREAD_STACK_ARRAY_DEFINE()

static K_THREAD_STACK_ARRAY_DEFINE ( tstack  ,
,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ tmslab_api()

static void tmslab_api ( void *  p1,
void *  p2,
void *  p3 
)
static

Variable Documentation

◆ slab_id

atomic_t slab_id
static

◆ slabs

struct k_mem_slab mslab2* slabs[2] = { &mslab1, &mslab2 }
static

◆ success

volatile bool success[4]
static

◆ tdata

struct k_thread tdata[4]
static

◆ tslab

char tslab[8 *(4 *(3 - 1)+1)]
static