#include <rtthread.h>
#define THREAD_PRIORITY 10
#define THREAD_TIMESLICE 5
static char mb_pool[128];
static char mb_str1[] = "I'm a mail!";
static char mb_str2[] = "this is another mail!";
static char mb_str3[] = "over";
ALIGN(RT_ALIGN_SIZE)
static char thread1_stack[1024];
static void thread1_entry(void *parameter)
{
char *str;
while (1)
{
{
rt_kprintf(
"thread1: get a mail from mailbox, the content:%s\n", str);
if (str == mb_str3)
break;
}
}
}
ALIGN(RT_ALIGN_SIZE)
static char thread2_stack[1024];
static void thread2_entry(void *parameter)
{
count = 0;
while (count < 10)
{
count ++;
if (count & 0x1)
{
}
else
{
}
}
}
int mailbox_sample(void)
{
"mbt",
&mb_pool[0],
sizeof(mb_pool) / 4,
{
return -1;
}
"thread1",
thread1_entry,
&thread1_stack[0],
sizeof(thread1_stack),
THREAD_PRIORITY, THREAD_TIMESLICE);
"thread2",
thread2_entry,
&thread2_stack[0],
sizeof(thread2_stack),
THREAD_PRIORITY, THREAD_TIMESLICE);
return 0;
}