aboutsummaryrefslogtreecommitdiffstats
path: root/examples/print-thread-safe.c
blob: 68f7417da47e80b0bb3baafa8485cabcc65313dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* ==========================================================================
    Licensed under BSD 2clause license See LICENSE file for more information
    Author: Michał Łyszczek <michal.lyszczek@bofc.pl>
   ========================================================================== */

#include "embedlog.h"

#ifdef EMBEDLOG_DEMO_LIBRARY
int el_demo_print_thread_safe_main(void)
#else
int main(void)
#endif
{
	el_init();

	if (el_option(EL_THREAD_SAFE, 1) != 0)
	{
		el_perror(ELF, "Failed to enable thread safety");
		el_cleanup();
		return 1;
	}

	el_print(ELI, "Yeaaa.... there is no really good way to show");
	el_print(ELI, "how pthread works in action, so this just checks");
	el_print(ELI, "whether locking works at all");

	el_cleanup();
	return 0;
}