github.com/moontrade/unsafe@v0.9.1/cgo/internal/trampoline/trampoline.cpp (about)

     1  #include <assert.h>
     2  #include <stdio.h>
     3  #include <stdlib.h>
     4  #include <time.h>
     5  #include <pthread.h>
     6  #include <stdio.h>
     7  #include <time.h>
     8  #include <unistd.h>
     9  #include <thread>
    10  #include <chrono>
    11  #include "trampoline.h"
    12  
    13  void moontrade_stub() {}
    14  
    15  //typedef void moontrade_trampoline_handler(size_t arg0, size_t arg1);
    16  
    17  void moontrade_trampoline(size_t fn, size_t arg0, size_t arg1) {
    18  	((moontrade_trampoline_handler*)fn)(arg0, arg1);
    19  }
    20  
    21  void moontrade_sleep(size_t arg0, size_t arg1) {
    22  	std::this_thread::sleep_for((std::chrono::nanoseconds)arg0);
    23  }