00001 #include "common/epoc-event-internal.h" 00002 #include <e32std.h> 00003 #include "application_config.h" 00004 #include "common/assertions.h" 00005 #include "common/logging.h" 00006 00007 // ----------------------------------------------------- 00008 00009 #if EVENT_CALLBACK_WITH_GERROR 00010 #include "epoc-ao-gerror.hpp" // CL2 only 00011 #define ACTIVE_SCHEDULER_TYPE CActiveSchedulerG 00012 #else 00013 #define ACTIVE_SCHEDULER_TYPE CActiveScheduler 00014 #endif 00015 00016 EXTERN_C int AoScheduler_install(MAYBE_ERROR_SOLE_PARAM) 00017 { 00018 #if __IS_DAEMON__ 00019 CActiveScheduler* as = new ACTIVE_SCHEDULER_TYPE(MAYBE_ERROR_SOLE_ARG); 00020 if (!as) 00021 return KErrNoMemory; 00022 CActiveScheduler::Install(as); 00023 #else 00024 assert(0 && "AoScheduler_install not supported for apps"); 00025 #endif 00026 return 0; 00027 } 00028 00029 EXTERN_C void AoScheduler_uninstall() 00030 { 00031 CActiveScheduler* as = CActiveScheduler::Current(); 00032 assert(as && "no active scheduler to uninstall"); 00033 CActiveScheduler::Install(NULL); // uninstall (xxx does this delete the old one?) 00034 delete as; 00035 } 00036 00037 // Replacing retains any registered active objects, but moves the 00038 // registration to the new one. 00039 EXTERN_C int AoScheduler_replace(MAYBE_ERROR_SOLE_PARAM) 00040 { 00041 #if __IS_DAEMON__ 00042 CActiveScheduler* as = new ACTIVE_SCHEDULER_TYPE(MAYBE_ERROR_SOLE_ARG); 00043 if (!as) 00044 return KErrNoMemory; 00045 CActiveScheduler* old = CActiveScheduler::Replace(as); 00046 delete old; 00047 #else 00048 assert(0 && "AoScheduler_replace not supported for apps"); 00049 #endif 00050 return 0; 00051 } 00052 00053 // ----------------------------------------------------- 00054 00055 // Returns NULL if cannot allocate. 00056 EXTERN_C AoLoop* AoLoop_new() 00057 { 00058 return (AoLoop*)(new CActiveSchedulerWait()); 00059 } 00060 00061 EXTERN_C void AoLoop_delete(AoLoop* asw) 00062 { 00063 delete ((CActiveSchedulerWait*)asw); 00064 } 00065 00066 EXTERN_C void AoLoop_start(AoLoop* asw) 00067 { 00068 ((CActiveSchedulerWait*)asw)->Start(); 00069 } 00070 00071 EXTERN_C void AoLoop_stop(AoLoop* asw) 00072 { 00073 ((CActiveSchedulerWait*)asw)->AsyncStop(); 00074 } 00075 00076 /** 00077 00078 epoc-event-internal.cpp 00079 00080 Copyright 2009 Helsinki Institute for Information Technology (HIIT) 00081 and the authors. All rights reserved. 00082 00083 Authors: Tero Hasu <tero.hasu@hut.fi> 00084 00085 Permission is hereby granted, free of charge, to any person 00086 obtaining a copy of this software and associated documentation files 00087 (the "Software"), to deal in the Software without restriction, 00088 including without limitation the rights to use, copy, modify, merge, 00089 publish, distribute, sublicense, and/or sell copies of the Software, 00090 and to permit persons to whom the Software is furnished to do so, 00091 subject to the following conditions: 00092 00093 The above copyright notice and this permission notice shall be 00094 included in all copies or substantial portions of the Software. 00095 00096 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00097 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00098 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00099 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00100 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00101 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00102 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00103 SOFTWARE. 00104 00105 **/
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:52 2011 by Doxygen 1.6.1