Require that WorkQueue's QueueData is Sync rather than Send.

This commit is contained in:
Ms2ger 2015-07-04 08:55:18 +02:00
parent a0db2cf1bb
commit 028484526d
2 changed files with 12 additions and 3 deletions

View file

@ -129,7 +129,16 @@ pub struct SharedLayoutContext {
pub goal: ReflowGoal, pub goal: ReflowGoal,
} }
unsafe impl Send for SharedLayoutContext {} // FIXME(#6569) This implementations is unsound:
// XXX UNSOUND!!! for image_cache_task
// XXX UNSOUND!!! for image_cache_sender
// XXX UNSOUND!!! for constellation_chan
// XXX UNSOUND!!! for layout_chan
// XXX UNSOUND!!! for font_cache_task
// XXX UNSOUND!!! for stylist
// XXX UNSOUND!!! for new_animations_sender
// XXX UNSOUND!!! for canvas_layers_sender
unsafe impl Sync for SharedLayoutContext {}
pub struct LayoutContext<'a> { pub struct LayoutContext<'a> {
pub shared: &'a SharedLayoutContext, pub shared: &'a SharedLayoutContext,

View file

@ -93,7 +93,7 @@ fn next_power_of_two(mut v: u32) -> u32 {
v v
} }
impl<QueueData: Send, WorkData: Send> WorkerThread<QueueData, WorkData> { impl<QueueData: Sync, WorkData: Send> WorkerThread<QueueData, WorkData> {
/// The main logic. This function starts up the worker and listens for /// The main logic. This function starts up the worker and listens for
/// messages. /// messages.
fn start(&mut self) { fn start(&mut self) {
@ -232,7 +232,7 @@ pub struct WorkQueue<QueueData: 'static, WorkData: 'static> {
work_count: usize, work_count: usize,
} }
impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> { impl<QueueData: Sync, WorkData: Send> WorkQueue<QueueData, WorkData> {
/// Creates a new work queue and spawns all the threads associated with /// Creates a new work queue and spawns all the threads associated with
/// it. /// it.
pub fn new(task_name: &'static str, pub fn new(task_name: &'static str,