servo: Merge #6570 - Require that WorkQueue's QueueData is Sync rather than Send (from Ms2ger:workqueue-sync); r=pcwalton

Source-Repo: https://github.com/servo/servo
Source-Revision: c76720d67c0d04f6d77c138c295b4fd4ebf24ee3
This commit is contained in:
Ms2ger 2015-07-07 13:07:31 -06:00
parent 973311f4cb
commit 487ed050b8
2 changed files with 12 additions and 3 deletions

View File

@ -129,7 +129,16 @@ pub struct SharedLayoutContext {
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 shared: &'a SharedLayoutContext,

View File

@ -93,7 +93,7 @@ fn next_power_of_two(mut v: u32) -> u32 {
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
/// messages.
fn start(&mut self) {
@ -232,7 +232,7 @@ pub struct WorkQueue<QueueData: 'static, WorkData: 'static> {
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
/// it.
pub fn new(task_name: &'static str,