X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=docs%2Fsources%2Fmono-api-gchandle.html;h=3ff8536dd396ddad5a129b88c9509657126f2456;hb=100bd760a46811121b4b47ebba941d4fb98486ab;hp=2f090b7773bd19cf1275632ce40d1603d6eda4fa;hpb=4e5e61cf501ef587ec36aaf80d04d734ca0efaca;p=mono.git diff --git a/docs/sources/mono-api-gchandle.html b/docs/sources/mono-api-gchandle.html index 2f090b7773b..3ff8536dd39 100644 --- a/docs/sources/mono-api-gchandle.html +++ b/docs/sources/mono-api-gchandle.html @@ -2,7 +2,7 @@

Synopsys

-
+
@API_IDX@
@@ -31,7 +31,8 @@ mono_gchandle_get_target.

For example, consider the following C code: -

+ +
static MonoObject* o = NULL;
@@ -41,22 +42,22 @@ static MonoObject* o = NULL; it from being collected, you need to acquire a GC handle for it. -
- guint32 handle = mono_gchandle_new (my_object, TRUE); +
+guint32 handle = mono_gchandle_new (my_object, TRUE);

TRUE means the object will be pinned, so it won't move in memory when we'll use a moving GC. You can access the MonoObject* referenced by a handle with: -

- MonoObject* obj = mono_gchandle_get_target (handle); +
+MonoObject* obj = mono_gchandle_get_target (handle);

When you don't need the handle anymore you need to call: -

- mono_gchandle_free (handle); +
+mono_gchandle_free (handle);

Note that if you assign a new object to the C var, you need @@ -65,31 +66,30 @@ static MonoObject* o = NULL;

So code that looked like this: -

- static MonoObject* o = NULL; - ... - o = mono_object_new (...); - /* use o */ - ... - /* when done to allow the GC to collect o */ - o = NULL; +
+static MonoObject* obj = NULL; +... +obj = mono_object_new (...); +// use obj +... +// when done to allow the GC to collect obj +obj = NULL;

should now be changed to: -

- static guint32 o_handle; - ... - MonoObject *o = mono_object_new (...); - o_handle = mono_gchandle_new (o, TRUE); - /* use o or mono_gchandle_get_target (o_handle) */ - ... - /* when done to allow the GC to collect o */ - mono_gchandle_free (o_handle); +
+static guint32 o_handle; +... +MonoObject *obj = mono_object_new (...); +o_handle = mono_gchandle_new (obj, TRUE); +// use o or mono_gchandle_get_target (o_handle) +... +// when done to allow the GC to collect obj +mono_gchandle_free (o_handle);

mono_gchandle_new

mono_gchandle_new_weakref

mono_gchandle_get_target

-

mono_gchandle_is_in_domain

mono_gchandle_free