Commit 66a7e2bd authored by Maciej Fijalkowski's avatar Maciej Fijalkowski

fix those things (maybe?)

parent 714c2cd4
......@@ -8,16 +8,12 @@
extern "C" {
/* You should call this first once. */
#define pypy_init(need_threads) do { pypy_asm_stack_bottom(); \
if (need_threads) pypy_init_threads(); } while (0)
// call this first
char* rpython_startup_code(void);
// deprecated interface
void rpython_startup_code(void);
// pypy_init_threads has to be called in case you want to use threads
void pypy_init_threads(void);
/* Initialize the home directory of PyPy. It is necessary to call this.
Call it with "home" being the file name of the, for
......@@ -14,12 +14,15 @@ The resulting shared library has very few functions that are however enough
to make a full API working, provided you'll follow a few principles. The API
.. function:: void pypy_init(int need_threads);
.. function:: char* rpython_startup_code(void);
This is a function that you have to call (once) before calling anything.
It initializes the RPython/PyPy GC and does a bunch of necessary startup
code. This function cannot fail. Pass 1 in case you need thread support, 0
code. This function cannot fail and always returns NULL.
.. function:: void pypy_init_threads(void);
Initialize threads. Only need to be called if there are any threads involved
.. function:: long pypy_setup_home(char* home, int verbose);
......@@ -46,7 +49,7 @@ is:
In case your application uses threads that are initialized outside of PyPy,
you need to call this function to tell the PyPy GC to track this thread.
Note that this function is not thread-safe itself, so you need to guard it
with a mutex. Do not call it from the main thread.
with a mutex.
Simple example
......@@ -80,7 +80,7 @@ def create_entry_point(space, w_dict):
# register the minimal equivalent of running a small piece of code. This
# should be used as sparsely as possible, just to register callbacks
from rpython.rlib.entrypoint import entrypoint
from rpython.rlib.entrypoint import entrypoint, RPython_StartupCode
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rtyper.lltypesystem.lloperation import llop
......@@ -94,7 +94,6 @@ def create_entry_point(space, w_dict):
@entrypoint('main', [rffi.CCHARP, rffi.INT], c_name='pypy_setup_home')
def pypy_setup_home(ll_home, verbose):
from pypy.module.sys.initpath import pypy_find_stdlib
verbose = rffi.cast(lltype.Signed, verbose)
if ll_home:
home = rffi.charp2str(ll_home)
......@@ -124,7 +123,6 @@ def create_entry_point(space, w_dict):
def pypy_execute_source(ll_source):
after = rffi.aroundstate.after
if after: after()
source = rffi.charp2str(ll_source)
res = _pypy_execute_source(source)
before = rffi.aroundstate.before
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment