Skip to content

Commit

Permalink
Fix two bugs
Browse files Browse the repository at this point in the history
bug 1: read-only or write-only resources were not
    added to the reverse dependcy lists,
    but accessed in find_runnable_task

bug 2: shred-derive did not build a hash value and
    did not use () as the default
  • Loading branch information
torkleyy committed May 6, 2017
1 parent fcd9c2e commit 04babcd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shred-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ fn impl_task_data(ast: &MacroInput) -> Tokens {
impl<'a> ::shred::TaskData<'a> for #name<'a> {
fn fetch(res: &'a ::shred::Resources) -> #name<'a> {
#name {
#( #identifiers: unsafe { res.#methods(0) }, )*
#( #identifiers: unsafe { res.#methods(()) }, )*
}
}

unsafe fn reads() -> Vec<::shred::ResourceId> {
use std::any::TypeId;

vec![ #( (TypeId::of::<#reads>(), 0) ),* ]
vec![ #( (TypeId::of::<#reads>(), 14695981039346656037) ),* ]
}

unsafe fn writes() -> Vec<::shred::ResourceId> {
use std::any::TypeId;

vec![ #( (TypeId::of::<#writes>(), 0) ),* ]
vec![ #( (TypeId::of::<#writes>(), 14695981039346656037) ),* ]
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@ impl Dependencies {
.entry(*read)
.or_insert(Vec::new())
.push(id);

self.rev_writes
.entry(*read)
.or_insert(Vec::new());
}

for write in &writes {
self.rev_reads
.entry(*write)
.or_insert(Vec::new());

self.rev_writes
.entry(*write)
.or_insert(Vec::new())
Expand Down

0 comments on commit 04babcd

Please sign in to comment.