00001 #ifndef __gxlowmem_h__ 00002 #define __gxlowmem_h__ 00003 00004 // What makes the use of these trap harnesses very delicate is that 00005 // there can be no nesting. One thread, one trap set at a time, as 00006 // there is only one jmp_buf (as filled in by setjmp()). 00007 // 00008 // This mechanism may also not mesh well with C++ exceptions. Better 00009 // not to have overlap between the extents of the two. 00010 // 00011 // For an "Introduction to Glib low memory handler", see http://library.forum.nokia.com/topic/S60_5th_Edition_Cpp_Developers_Library/GUID-FE27AB35-C6FD-4F11-802D-0D5FCFFC2976/html/mrt/s60_openc_using_glib8.html#topic7 00012 00013 #if defined(__SYMBIAN32__) 00014 00015 #include "common/glowmem_action.h" 00016 00017 #define TRAP_OOM(_err_act, _do_act) { \ 00018 SET_LOW_MEMORY_TRAP_ACTION(_err_act); \ 00019 { _do_act; } \ 00020 REMOVE_LOW_MEMORY_TRAP(); \ 00021 } 00022 00023 #define HAVE_TRAP_OOM 1 00024 #define WHEN_TRAP_OOM(_do_act) { _do_act; } 00025 00026 #else 00027 00028 #define SET_LOW_MEMORY_TRAP_VOID() 00029 #define SET_LOW_MEMORY_TRAP(failure_value) 00030 #define SET_LOW_MEMORY_TRAP_ACTION(action) 00031 #define REMOVE_LOW_MEMORY_TRAP() 00032 00033 #define TRAP_OOM(_err_act, _do_act) { _do_act; } 00034 00035 #define HAVE_TRAP_OOM 0 00036 #define WHEN_TRAP_OOM(_do_act) 00037 00038 #endif /* not __SYMBIAN32__ */ 00039 00040 #define TRAP_OOM_VALUE(_err_val, _do_act) \ 00041 TRAP_OOM(return _err_val, _do_act) 00042 00043 #define TRAP_OOM_NULL(_do_act) \ 00044 TRAP_OOM_VALUE(NULL, _do_act) 00045 00046 #define TRAP_OOM_VOID(_do_act) \ 00047 TRAP_OOM(return, _do_act) 00048 00049 #define TRAP_OOM_FAIL(_do_act) \ 00050 TRAP_OOM(goto fail, _do_act) 00051 00052 // These aliases are just to make it easy to grep for "TRAP_OOM". 00053 #define SET_TRAP_OOM_VOID() SET_LOW_MEMORY_TRAP_VOID() 00054 #define SET_TRAP_OOM_VALUE(_val) SET_LOW_MEMORY_TRAP(_val) 00055 #define SET_TRAP_OOM(_act) SET_LOW_MEMORY_TRAP_ACTION(_act) 00056 #define UNSET_TRAP_OOM() REMOVE_LOW_MEMORY_TRAP() 00057 00058 #define SET_TRAP_OOM_FAIL() SET_TRAP_OOM(goto fail) 00059 00060 #endif /* __gxlowmem_h__ */ 00061 00062 /** 00063 00064 gxlowmem.h 00065 00066 Copyright 2010 Helsinki Institute for Information Technology (HIIT) 00067 and the authors. All rights reserved. 00068 00069 Authors: Tero Hasu <tero.hasu@hut.fi> 00070 00071 Permission is hereby granted, free of charge, to any person 00072 obtaining a copy of this software and associated documentation files 00073 (the "Software"), to deal in the Software without restriction, 00074 including without limitation the rights to use, copy, modify, merge, 00075 publish, distribute, sublicense, and/or sell copies of the Software, 00076 and to permit persons to whom the Software is furnished to do so, 00077 subject to the following conditions: 00078 00079 The above copyright notice and this permission notice shall be 00080 included in all copies or substantial portions of the Software. 00081 00082 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00083 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00084 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00085 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00086 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00087 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00088 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00089 SOFTWARE. 00090 00091 **/
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:54 2011 by Doxygen 1.6.1