Skip to content

Instantly share code, notes, and snippets.

View koppi's full-sized avatar
:octocat:

Jakob Flierl koppi

:octocat:
View GitHub Profile
@hmenke
hmenke / mqueue.c
Last active May 17, 2022 12:24
Example of POSIX mqueue to communicate with pthreads.
#ifndef __cplusplus
#define _GNU_SOURCE
#endif
// C standard library
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@gustavorv86
gustavorv86 / c_priority_queue_threads.c
Last active September 8, 2023 04:42
POSIX message priority queue example written in C/C++
/**
* Compile:
* gcc -std=gnu11 -Wall -Wextra c_priority_queue_threads.c -o priority_queue_threads -lpthread -lrt
*/
#include <errno.h>
#include <mqueue.h>
#include <fcntl.h> /* For O_* constants. */
#include <sys/stat.h> /* For mode constants. */