Simple shared memory example.
#include <l4/util/util.h>
#include <stdio.h>
#include <pthread-l4.h>
#include <l4/sys/thread.h>
#define CHK(func) if (func) { printf("failure: %d\n", __LINE__); return (void *)-1; }
static const char some_data[] = "Hi consumer!";
static void *thread_producer(void *d)
{
(void)d;
l4shmc_chunk_t p_one;
l4shmc_signal_t s_one, s_done;
l4shmc_area_t shmarea;
pthread_l4_cap(pthread_self()), 10000, &s_done));
printf("PRODUCER: ready\n");
while (1)
{
printf("Uh, should not happen!\n");
printf("PRODUCER: Sent data\n");
}
return NULL;
}
static void *thread_consume(void *d)
{
(void)d;
l4shmc_area_t shmarea;
l4shmc_chunk_t p_one;
l4shmc_signal_t s_one, s_done;
pthread_l4_cap(pthread_self()), 10000, &s_one));
while (1)
{
printf("CONSUMER: Received from chunk one: %s\n",
}
return NULL;
}
int main(void)
{
pthread_t one, two;
return 1;
pthread_create(&one, 0, thread_producer, 0);
pthread_create(&two, 0, thread_consume, 0);
return 0;
}