mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-03-14 10:50:05 +01:00
[SPCA] Synchronization
This commit is contained in:
13
semester3/spca/code-examples/03_hw/01_tas.c
Normal file
13
semester3/spca/code-examples/03_hw/01_tas.c
Normal file
@@ -0,0 +1,13 @@
|
||||
void acquire( int *lock ) {
|
||||
while ( TAS( lock ) == 1 );
|
||||
}
|
||||
|
||||
void acquire_tatas( int *lock ) {
|
||||
do {
|
||||
while ( *lock == 1 );
|
||||
} while ( TAS( lock ) == 1 );
|
||||
}
|
||||
|
||||
void release( int *lock ) {
|
||||
*lock = 0;
|
||||
}
|
||||
0
semester3/spca/code-examples/03_hw/02_cas.c
Normal file
0
semester3/spca/code-examples/03_hw/02_cas.c
Normal file
Reference in New Issue
Block a user