Skip to content
This repository was archived by the owner on Jul 3, 2020. It is now read-only.

android: Updated for rust e583c4d24 2014-11-21 09:01:50 +0000 #11

Merged
merged 1 commit into from
Nov 21, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions glue/src/lib.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
extern crate compile_msg;

extern crate libc;
extern crate native;

use std::sync::Mutex;

@@ -62,7 +61,6 @@ macro_rules! android_start(
/// This is the function that must be called by `android_main`
#[doc(hidden)]
pub fn android_main2(app: *mut (), main_function: proc(): Send) {
use native::NativeTaskBuilder;
use std::task::TaskBuilder;
use std::{mem, ptr};

@@ -72,15 +70,15 @@ pub fn android_main2(app: *mut (), main_function: proc(): Send) {
let app: &mut ffi::android_app = unsafe { std::mem::transmute(app) };

// starting the runtime
native::start(1, &b"".as_ptr(), proc() {
std::rt::start(1, &b"".as_ptr(), proc() {
// creating the context that will be passed to the callback
let context = Context { senders: Mutex::new(Vec::new()) };
app.onAppCmd = commands_callback;
app.onInputEvent = inputs_callback;
app.userData = unsafe { std::mem::transmute(&context) };

// executing the main function in parallel
TaskBuilder::new().native().spawn(proc() {
spawn(proc() {
std::io::stdio::set_stdout(box std::io::LineBufferedWriter::new(ToLogWriter));
std::io::stdio::set_stderr(box std::io::LineBufferedWriter::new(ToLogWriter));
main_function()