lfn
serial
ticket/834-toolchain-update
topic/msim-upgrade
topic/simplify-dev-export
|
Last change
on this file since 7bd34e5 was 7bd34e5, checked in by Jan Vesely <jano.vesely@…>, 15 years ago |
|
Add synchronization via fibril_semaphore
WARNING: fibril_semaphore BREAKS the deadlock detection system
used by fibril synch primitives
|
-
Property mode
set to
100644
|
|
File size:
905 bytes
|
| Line | |
|---|
| 1 | #include "hc_synchronizer.h"
|
|---|
| 2 |
|
|---|
| 3 | void sync_init(sync_value_t *value)
|
|---|
| 4 | {
|
|---|
| 5 | assert(value);
|
|---|
| 6 | fibril_semaphore_initialize(&value->done, 0);
|
|---|
| 7 | }
|
|---|
| 8 | /*----------------------------------------------------------------------------*/
|
|---|
| 9 | void sync_wait_for(sync_value_t *value)
|
|---|
| 10 | {
|
|---|
| 11 | assert( value );
|
|---|
| 12 | fibril_semaphore_down(&value->done);
|
|---|
| 13 | }
|
|---|
| 14 | /*----------------------------------------------------------------------------*/
|
|---|
| 15 | void sync_in_callback(
|
|---|
| 16 | device_t *device, usb_transaction_outcome_t result, size_t size, void *arg)
|
|---|
| 17 | {
|
|---|
| 18 | sync_value_t *value = arg;
|
|---|
| 19 | assert(value);
|
|---|
| 20 | value->size = size;
|
|---|
| 21 | value->result = result;
|
|---|
| 22 | fibril_semaphore_up(&value->done);
|
|---|
| 23 | }
|
|---|
| 24 | /*----------------------------------------------------------------------------*/
|
|---|
| 25 | void sync_out_callback(
|
|---|
| 26 | device_t *device, usb_transaction_outcome_t result, void *arg)
|
|---|
| 27 | {
|
|---|
| 28 | sync_value_t *value = arg;
|
|---|
| 29 | assert(value);
|
|---|
| 30 | value->result = result;
|
|---|
| 31 | fibril_semaphore_up(&value->done);
|
|---|
| 32 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.