lfn
serial
ticket/834-toolchain-update
topic/msim-upgrade
topic/simplify-dev-export
Last change
on this file since 93fb170c was 7bd34e5, checked in by Jan Vesely <jano.vesely@…>, 14 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
|
Rev | Line | |
---|
[92f924c8] | 1 | #include "hc_synchronizer.h"
|
---|
| 2 |
|
---|
[7bd34e5] | 3 | void sync_init(sync_value_t *value)
|
---|
| 4 | {
|
---|
| 5 | assert(value);
|
---|
| 6 | fibril_semaphore_initialize(&value->done, 0);
|
---|
| 7 | }
|
---|
| 8 | /*----------------------------------------------------------------------------*/
|
---|
[92f924c8] | 9 | void sync_wait_for(sync_value_t *value)
|
---|
| 10 | {
|
---|
| 11 | assert( value );
|
---|
[7bd34e5] | 12 | fibril_semaphore_down(&value->done);
|
---|
[92f924c8] | 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;
|
---|
[7bd34e5] | 22 | fibril_semaphore_up(&value->done);
|
---|
[92f924c8] | 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;
|
---|
[7bd34e5] | 31 | fibril_semaphore_up(&value->done);
|
---|
[92f924c8] | 32 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.