about summary refs log tree commit diff
path: root/src/rt/rust_test_helpers.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-04-29 18:28:01 -0700
committerBrian Anderson <banderson@mozilla.com>2013-04-30 17:01:27 -0700
commit4a4646fd54a85f78512e5f2d1d2cd253954d1ea4 (patch)
tree11e6e1bd26bf1cbdd278f30978fb632b0c74d7f7 /src/rt/rust_test_helpers.cpp
parentf1ddb8d5cc66941763039d3f727465b7cc34a100 (diff)
parent6818e241b49c03c0fe0994dbe8340e2d8f482f09 (diff)
downloadrust-4a4646fd54a85f78512e5f2d1d2cd253954d1ea4.tar.gz
rust-4a4646fd54a85f78512e5f2d1d2cd253954d1ea4.zip
Merge remote-tracking branch 'brson/io'
Conflicts:
	src/libcore/task/local_data_priv.rs
Diffstat (limited to 'src/rt/rust_test_helpers.cpp')
-rw-r--r--src/rt/rust_test_helpers.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rt/rust_test_helpers.cpp b/src/rt/rust_test_helpers.cpp
index 64966bd3454..d82c39d6838 100644
--- a/src/rt/rust_test_helpers.cpp
+++ b/src/rt/rust_test_helpers.cpp
@@ -165,3 +165,14 @@ extern "C" CDECL TwoDoubles
 rust_dbg_extern_identity_TwoDoubles(TwoDoubles u) {
     return u;
 }
+
+// Generates increasing port numbers for network testing
+extern "C" CDECL uintptr_t
+rust_dbg_next_port() {
+  static lock_and_signal dbg_port_lock;
+  static uintptr_t next_port = 9600;
+  scoped_lock with(dbg_port_lock);
+  uintptr_t this_port = next_port;
+  next_port += 1;
+  return this_port;
+}