Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Linux/fs/bcachefs/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 825 B image not shown  

Quelle  seqmutex.h   Sprache: C

 
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _BCACHEFS_SEQMUTEX_H
#define _BCACHEFS_SEQMUTEX_H

#include <linux/mutex.h>

struct seqmutex {
 struct mutex lock;
 u32  seq;
};

#define seqmutex_init(_lock) mutex_init(&(_lock)->lock)

static inline bool seqmutex_trylock(struct seqmutex *lock)
{
 return mutex_trylock(&lock->lock);
}

static inline void seqmutex_lock(struct seqmutex *lock)
{
 mutex_lock(&lock->lock);
 lock->seq++;
}

static inline u32 seqmutex_unlock(struct seqmutex *lock)
{
 u32 seq = lock->seq;
 mutex_unlock(&lock->lock);
 return seq;
}

static inline bool seqmutex_relock(struct seqmutex *lock, u32 seq)
{
 if (lock->seq != seq || !mutex_trylock(&lock->lock))
  return false;

 if (lock->seq != seq) {
  mutex_unlock(&lock->lock);
  return false;
 }

 return true;
}

#endif /* _BCACHEFS_SEQMUTEX_H */

Messung V0.5
C=95 H=92 G=93

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.