2 Copyright © 2009-2012, The AROS Development Team. All rights reserved.
5 AROS function sharecontextwithchild().
8 #include "__arosc_privdata.h"
9 #include <aros/debug.h>
11 /*****************************************************************************
16 void sharecontextwithchild (
22 Controls sharing parent arosc context with child processes.
23 Must be called by parent process.
26 share - TRUE/FALSE - should parent share context with children
31 By calling this function the user of arosc.library controls how
32 new child processes use parent's arosc.library context.
34 When sharing is enabled, a child process will never create its
35 own arosc.library context and will alway use parent's context.
37 If you have a parent and child process allocating/dealocating
38 (malloc/free) memory for the same pointer, you must use this
39 function so that the memory will always be allocated in the
40 same arosc.libray context. Failure to do so will result with
43 Things to be aware off:
44 - this function is dangeruos - you as a programmer must take care
45 of thread synchronization
46 - a child process cannot have life span longer than a parent process
47 - a child process may not call vfork or exec* functions - if such
48 feature is required, the vfork and exec* functions need to be
49 modified to work with flag set by this function
50 - once enabled, the sharing can be disabled at any time - when
51 the sharing is disabled, all child processes will acquire their
52 own arosc contexts when such need arises.
62 ******************************************************************************/
64 struct aroscbase
*aroscbase
= __aros_getbase_aroscbase();
69 aroscbase
->acb_flags
|= SHARE_ACPD_WITH_CHILD
;
71 aroscbase
->acb_flags
&= ~SHARE_ACPD_WITH_CHILD
;
73 } /* sharecontextwithchild() */