1

add vorgabe10

This commit is contained in:
2022-07-11 13:29:54 +02:00
parent 2d2eec6934
commit bb0ff5104c
5 changed files with 180 additions and 1 deletions

31
c_os/lib/SpinLock.h Normal file
View File

@ -0,0 +1,31 @@
/*****************************************************************************
* *
* S P I N L O C K *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Implementierung eines Spinlocks mithilfe der cmpxchg *
* Instruktion. *
* *
* Autor: Michael Schoettner, 2.2.2018 *
*****************************************************************************/
#ifndef __SpinLock_include__
#define __SpinLock_include__
class SpinLock {
private:
SpinLock(const SpinLock& copy) = delete; // Verhindere Kopieren
unsigned long lock;
unsigned long* ptr;
public:
SpinLock() : lock(0), ptr(&lock) {}
void acquire();
void release();
};
#endif