1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

core/pthread: make them compilable with g++

This commit is contained in:
Gunar Schorcht 2018-07-10 02:19:55 +02:00
parent a0a31120b2
commit 9db03537b9
2 changed files with 16 additions and 3 deletions

View File

@ -48,6 +48,14 @@ inline int sched_yield(void)
puts("[ERROR] sched_yield called (defined in sched.h)\n");
return 0;
}
#else
/**
* @brief Compilation with g++ may require the declaration of this function.
*
* If implementation of this function is required, it can be realized in
* thread_arch.c.
*/
extern int sched_yield(void);
#endif /* BOARD_NATIVE */
#ifdef __cplusplus

View File

@ -20,10 +20,11 @@
#ifndef PTHREAD_SPIN_H
#define PTHREAD_SPIN_H
#include <stdatomic.h>
#ifdef __cplusplus
extern "C" {
#include <atomic>
using std::atomic_flag;
#else
#include <stdatomic.h>
#endif
/**
@ -36,6 +37,10 @@ typedef struct {
atomic_flag flag; /**< Current lock state */
} pthread_spinlock_t;
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Intializes a spinlock.
* @warning See the warning in pthread_spinlock_t.