#include <list.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | semaphore |
struct | lock |
struct | condition |
Defines | |
#define | barrier() asm volatile ("" : : : "memory") |
Functions | |
void | sema_init (struct semaphore *, unsigned value) |
void | sema_down (struct semaphore *) |
bool | sema_try_down (struct semaphore *) |
void | sema_up (struct semaphore *) |
void | sema_self_test (void) |
void | lock_init (struct lock *) |
void | lock_acquire (struct lock *) |
bool | lock_try_acquire (struct lock *) |
void | lock_release (struct lock *) |
bool | lock_held_by_current_thread (const struct lock *) |
void | cond_init (struct condition *) |
void | cond_wait (struct condition *, struct lock *) |
void | cond_signal (struct condition *, struct lock *) |
void | cond_broadcast (struct condition *, struct lock *) |
#define barrier | ( | ) | asm volatile ("" : : : "memory") |
Definition at line 50 of file synch.h.
Referenced by busy_wait(), timer_ticks(), too_many_loops(), uhci_add_td_to_qh(), and uhci_create_chan().
Definition at line 332 of file synch.c.
References ASSERT, cond_signal(), list_empty(), NULL, and condition::waiters.
void cond_init | ( | struct condition * | ) |
Definition at line 261 of file synch.c.
References ASSERT, list_init(), NULL, and condition::waiters.
Referenced by test_priority_condvar().
Definition at line 289 of file synch.c.
References ASSERT, semaphore_elem::elem, intr_context(), list_push_back(), lock_acquire(), lock_held_by_current_thread(), lock_release(), NULL, sema_down(), sema_init(), semaphore_elem::semaphore, and condition::waiters.
Referenced by priority_condvar_thread().
void lock_acquire | ( | struct lock * | ) |
Definition at line 194 of file synch.c.
References ASSERT, lock::holder, intr_context(), lock_held_by_current_thread(), NULL, sema_down(), lock::semaphore, and thread_current().
Referenced by a_thread_func(), acquire1_thread_func(), acquire2_thread_func(), acquire_console(), acquire_thread_func(), allocate_tid(), b_thread_func(), block_print_stats(), block_read(), block_thread(), block_write(), cond_wait(), donor_thread_func(), free(), h_thread_func(), high_thread_func(), ide_read(), ide_write(), intq_getc(), intq_putc(), l_thread_func(), malloc(), medium_thread_func(), palloc_get_multiple(), priority_condvar_thread(), simple_thread_func(), sleeper(), test_mlfqs_block(), test_priority_condvar(), test_priority_donate_chain(), test_priority_donate_lower(), test_priority_donate_multiple(), test_priority_donate_multiple2(), test_priority_donate_nest(), test_priority_donate_one(), and test_sleep().
bool lock_held_by_current_thread | ( | const struct lock * | ) |
Definition at line 243 of file synch.c.
References ASSERT, lock::holder, NULL, and thread_current().
Referenced by acquire_console(), cond_signal(), cond_wait(), console_locked_by_current_thread(), lock_acquire(), lock_release(), lock_try_acquire(), qh_alloc(), qh_free(), uhci_acquire_td(), uhci_remove_qh(), uhci_run(), and uhci_stop().
void lock_init | ( | struct lock * | ) |
Definition at line 177 of file synch.c.
References ASSERT, lock::holder, NULL, sema_init(), and lock::semaphore.
Referenced by block_register(), console_init(), ide_init(), init_pool(), intq_init(), is_thread(), malloc_init(), msc_attached(), test_mlfqs_block(), test_priority_condvar(), test_priority_donate_chain(), test_priority_donate_lower(), test_priority_donate_multiple(), test_priority_donate_multiple2(), test_priority_donate_nest(), test_priority_donate_one(), test_priority_donate_sema(), test_priority_fifo(), test_sleep(), uhci_create_chan(), uhci_create_info(), and usb_init().
void lock_release | ( | struct lock * | ) |
Definition at line 230 of file synch.c.
References ASSERT, lock::holder, lock_held_by_current_thread(), NULL, sema_up(), and lock::semaphore.
Referenced by a_thread_func(), acquire1_thread_func(), acquire2_thread_func(), acquire_thread_func(), allocate_tid(), b_thread_func(), block_print_stats(), block_read(), block_write(), cond_wait(), donor_thread_func(), free(), h_thread_func(), high_thread_func(), ide_read(), ide_write(), intq_getc(), intq_putc(), l_thread_func(), malloc(), medium_thread_func(), palloc_get_multiple(), priority_condvar_thread(), release_console(), simple_thread_func(), sleeper(), test_mlfqs_block(), test_priority_condvar(), test_priority_donate_chain(), test_priority_donate_lower(), test_priority_donate_multiple(), test_priority_donate_multiple2(), test_priority_donate_nest(), test_priority_donate_one(), and test_sleep().
bool lock_try_acquire | ( | struct lock * | ) |
Definition at line 211 of file synch.c.
References ASSERT, lock::holder, lock_held_by_current_thread(), NULL, sema_try_down(), lock::semaphore, and thread_current().
void sema_down | ( | struct semaphore * | ) |
Definition at line 62 of file synch.c.
References ASSERT, intr_context(), intr_disable(), intr_set_level(), list_push_back(), NULL, thread_block(), thread_current(), semaphore::value, and semaphore::waiters.
Referenced by cond_wait(), ide_read(), ide_write(), identify_ata_device(), l_thread_func(), lock_acquire(), m_thread_func(), priority_sema_thread(), sema_self_test(), sema_test_helper(), test_alarm_priority(), thread_start(), uhci_acquire_td(), and uhci_tx_pkt_wait().
void sema_init | ( | struct semaphore * | , | |
unsigned | value | |||
) |
Definition at line 46 of file synch.c.
References ASSERT, list_init(), NULL, semaphore::value, and semaphore::waiters.
Referenced by cond_wait(), ide_init(), lock_init(), sema_self_test(), test_alarm_priority(), test_priority_donate_sema(), test_priority_sema(), thread_start(), uhci_create_info(), and uhci_tx_pkt_wait().
void sema_self_test | ( | void | ) |
Definition at line 130 of file synch.c.
References PRI_DEFAULT, printf(), sema_down(), sema_init(), sema_test_helper(), sema_up(), and thread_create().
bool sema_try_down | ( | struct semaphore * | ) |
Definition at line 85 of file synch.c.
References ASSERT, intr_disable(), intr_set_level(), NULL, and semaphore::value.
Referenced by lock_try_acquire().
void sema_up | ( | struct semaphore * | ) |
Definition at line 110 of file synch.c.
References ASSERT, intr_disable(), intr_set_level(), list_empty(), list_entry, list_pop_front(), NULL, thread_unblock(), semaphore::value, and semaphore::waiters.
Referenced by alarm_priority_thread(), cond_signal(), h_thread_func(), idle(), interrupt_handler(), lock_release(), sema_self_test(), sema_test_helper(), test_priority_donate_sema(), test_priority_sema(), uhci_destroy_chan(), uhci_process_completed(), uhci_release_td(), and uhci_remove_stalled().