Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
test_mslab_threadsafe.c File Reference
#include <ztest.h>
#include <sys/atomic.h>

Macros

#define LOOP   10
 
#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACKSIZE)
 
#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_STACKSIZE))
 
static void tmslab_api (void *p1, void *p2, void *p3)
 
void test_mslab_threadsafe (void)
 Verify alloc and free from multiple equal priority threads. More...
 

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_STACKSIZE)

◆ 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_STACKSIZE)   
)
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