Auto merge of #9385 - larsbergstrom:win32, r=frewsxcv,pcwalton,jdm,ecoal95

Win32 support

r? @frewsxcv for python stuff
r? @pcwalton for the "remove usage of Gaol" stuff for Win32
r? anybody else for misc cargo.lock updates, etc.

This replaces #7878.

This works best with https://github.com/servo/mozjs/pull/71, too, to enable static linking, but can be run without (via some PATH hackery).

The instructions are here, and will be added to a .md file in the repo once the mozjs changes also land:
https://hackpad.com/Servo-on-Windows-C1LPcI2bP25

I'd like to get these changes landed because I've been rebasing them for months, they're otherwise quite stable, and don't affect our other platforms and targets.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9385)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-01-23 07:27:27 +05:30
commit 525e77f64f
25 changed files with 431 additions and 288 deletions

View file

@ -66,3 +66,6 @@ getopts = "0.2.11"
hyper = { version = "0.7", optional = true }
url = {version = "0.5.2", features = ["serde_serialization"]}
uuid = "0.1.17"
[target.x86_64-pc-windows-gnu.dependencies]
kernel32-sys = "0.2"

View file

@ -7,7 +7,11 @@
//! Data associated with queues is simply a pair of unsigned integers. It is expected that a
//! higher-level API on top of this could allow safe fork-join parallelism.
#[cfg(windows)]
extern crate kernel32;
use deque::{Abort, BufferPool, Data, Empty, Stealer, Worker};
#[cfg(not(windows))]
use libc::usleep;
use rand::{Rng, XorShiftRng, weak_rng};
use std::sync::atomic::{AtomicUsize, Ordering};
@ -92,6 +96,20 @@ fn next_power_of_two(mut v: u32) -> u32 {
v
}
#[cfg(not(windows))]
fn sleep_microseconds(usec: u32) {
unsafe {
usleep(usec);
}
}
#[cfg(windows)]
fn sleep_microseconds(_: u32) {
unsafe {
kernel32::Sleep(0);
}
}
impl<QueueData: Sync, WorkData: Send> WorkerThread<QueueData, WorkData> {
/// The main logic. This function starts up the worker and listens for
/// messages.
@ -151,9 +169,8 @@ impl<QueueData: Sync, WorkData: Send> WorkerThread<QueueData, WorkData> {
}
}
unsafe {
usleep(back_off_sleep as u32);
}
sleep_microseconds(back_off_sleep);
back_off_sleep += BACKOFF_INCREMENT_IN_US;
i = 0
} else {