File: myth_sleep_queue.h

package info (click to toggle)
massivethreads 1.02-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,924 kB
  • sloc: ansic: 27,814; sh: 4,559; cpp: 3,334; javascript: 1,799; makefile: 1,745; python: 523; asm: 373; perl: 118; lisp: 9
file content (41 lines) | stat: -rw-r--r-- 895 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
/* 
 * myth_sleep_queue.h
 */
#pragma once
#ifndef MYTH_SLEEP_QUEUE_H_
#define MYTH_SLEEP_QUEUE_H_

#include "myth_spinlock.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifndef MYTH_SLEEP_QUEUE_DBG
#define MYTH_SLEEP_QUEUE_DBG 0
#endif

  /* myth_sleep_queue_item_t represents a pointer 
     to any data structure that has "next" field
     in its head */
  typedef struct myth_sleep_queue_item {
    struct myth_sleep_queue_item * next;
  } myth_sleep_queue_item, * myth_sleep_queue_item_t;

  typedef struct {
    myth_spinlock_t ilock[1];
    volatile myth_sleep_queue_item_t head;
    volatile myth_sleep_queue_item_t tail;
  } myth_sleep_queue_t;
  
#define MYTH_SLEEP_QUEUE_INITIALIZER { { MYTH_SPINLOCK_INITIALIZER }, 0, 0 }

  typedef struct {
    volatile myth_sleep_queue_item_t top;
  } myth_sleep_stack_t;

#ifdef __cplusplus
} // extern "C"
#endif

#endif	/* MYTH_SLEEP_QUEUE_H_ */