| 
    CS318 - Pintos
    
   Pintos source browser for JHU CS318 course 
   | 
 
 
 
 
Go to the documentation of this file.    1 #ifndef THREADS_SYNCH_H 
    2 #define THREADS_SYNCH_H 
   49 #define barrier() asm volatile ("" : : : "memory") 
 
struct thread * holder
Thread holding lock (for debugging).
 
A kernel thread or user process.
 
void lock_init(struct lock *)
Initializes LOCK.
 
void sema_self_test(void)
Self-test for semaphores that makes control "ping-pong" between a pair of threads.
 
void cond_wait(struct condition *, struct lock *)
Atomically releases LOCK and waits for COND to be signaled by some other piece of code.
 
struct list waiters
List of waiting threads.
 
void sema_down(struct semaphore *)
Down or "P" operation on a semaphore.
 
void sema_init(struct semaphore *, unsigned value)
This file is derived from source code for the Nachos instructional operating system.
 
void cond_signal(struct condition *, struct lock *)
 
void sema_up(struct semaphore *)
Up or "V" operation on a semaphore.
 
struct list waiters
List of waiting threads.
 
void lock_acquire(struct lock *)
Acquires LOCK, sleeping until it becomes available if necessary.
 
bool lock_held_by_current_thread(const struct lock *)
Returns true if the current thread holds LOCK, false otherwise.
 
unsigned value
Current value.
 
bool lock_try_acquire(struct lock *)
Tries to acquires LOCK and returns true if successful or false on failure.
 
void lock_release(struct lock *)
Releases LOCK, which must be owned by the current thread.
 
bool sema_try_down(struct semaphore *)
Down or "P" operation on a semaphore, but only if the semaphore is not already 0.
 
void cond_init(struct condition *)
Initializes condition variable COND.
 
void cond_broadcast(struct condition *, struct lock *)
Wakes up all threads, if any, waiting on COND (protected by LOCK).