pike.git
/
src
/
program.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/program.c:1:
/* || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: program.c,v 1.
613
2007/
04
/
25
22
:
02
:
07
mast Exp $
+
|| $Id: program.c,v 1.
614
2007/
05
/
13
14
:
55
:
26
mast Exp $
*/ #include "global.h" #include "program.h" #include "object.h" #include "dynamic_buffer.h" #include "pike_types.h" #include "stralloc.h" #include "las.h" #include "lex.h"
pike.git/src/program.c:347:
*! A flag that tells why the object is destructed: *! *! @int *! @value Object.DESTRUCT_EXPLICIT *! Destructed explicitly by @[predef::destruct]. *! @value Object.DESTRUCT_NO_REFS *! Destructed due to running out of references. *! @value Object.DESTRUCT_GC *! Destructed by the garbage collector. *! @value Object.DESTRUCT_CLEANUP
-
*! Destructed as part of the cleanup when the pike
program
-
*! exits.
Note
that
Pike
normally
doesn't
do
any
cleanup before
-
*!
exit - it must be compiled with the
configure option
-
*!
@tt{--with-cleanup-on-exit@}
to enable that
.
So
this value
-
*!
normally doesn't occur
.
+
*! Destructed as part of the cleanup when the pike
process
+
*! exits.
Occurs
only
if
Pike
has
been
compiled
with
the
+
*! configure option @tt{--with-cleanup-on-exit@}.
See
note
+
*!
below
.
*! @endint *! *! @note
-
+
*! Objects are normally not destructed when a process exits, so
+
*! @expr{destroy@} functions aren't called then. Use @[atexit] to get
+
*! called when the process exits.
+
*!
+
*! @note
*! Regarding destruction order during garbage collection: *! *! If an object is destructed by the garbage collector, it's part of *! a reference cycle with other things but with no external *! references. If there are other objects with @expr{destroy@} *! functions in the same cycle, it becomes a problem which to call *! first. *! *! E.g. if this object has a variable with another object which *! (directly or indirectly) points back to this one, you might find
pike.git/src/program.c:382:
*! @item *! If an object A contains an @[lfun::destroy] and an object B does *! not, then A is destructed before B. *! @item *! If A references B single way, then A is destructed before B. *! @item *! If A and B are in a cycle, and there is a reference somewhere *! from B to A that is weaker than any reference from A to B, then *! A is destructed before B. *! @item
-
*!
Weak
references
(e.g.
set
with
@[predef::set_weak_flag()])
are
considered
-
*! weaker
than normal references
, and
both
are
considered
weaker
-
*!
than
strong
references
.
+
*!
If
a
cycle
is
resolved
according
to
the rule above by ignoring a
+
*! weaker
reference
, and
there
is
another
ambiguous cycle that
+
*!
would
get
resolved by ignoring the same reference, then the
+
*! latter cycle will be resolved by ignoring that reference
.
*! @item
-
+
*! Weak references (e.g. set with @[predef::set_weak_flag()]) are
+
*! considered weaker than normal references, and both are
+
*! considered weaker than strong references.
+
*! @item
*! Strong references are those from objects to the objects of their *! lexically surrounding classes. There can never be a cycle *! consisting only of strong references. (This means the gc never *! destructs a parent object before all children have been *! destructed.) *! @endul *! *! An example with well defined destruct order due to strong *! references: *!