00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- 00002 00003 #ifndef preemption_h 00004 #define preemption_h 00005 00006 #include "sched_context.h" 00007 #include "sender.h" 00008 00009 // 00010 // INTERFACE definition follows 00011 // 00012 00013 00014 class Receiver; 00015 class Sched_context; 00016 /* 00017 * Fiasco 00018 * Preemption IPC Handling 00019 */ 00020 00021 00022 class Preemption : public Sender 00023 { 00024 private: 00025 Sched_context * _pending; 00026 00027 public: 00031 Preemption(Global_id const id); 00032 00036 inline void set_receiver(Receiver *receiver); 00037 00041 inline Sched_context * pending() const; 00042 00046 inline void set_pending(Sched_context *const sched); 00047 00055 void queue(Sched_context::Preemption_type type, Cpu_time time, Sched_context *sched); 00056 00057 private: 00058 /* 00059 * Enqueue in the preempter's sender list in order to send a Preemption IPC 00060 */ 00061 void preempter_enqueue(); 00062 00067 void ipc_receiver_ready(); 00068 00069 inline void setup_msg(L4_pipc const pipc) const; 00070 }; 00071 00072 // 00073 // IMPLEMENTATION includes follow (for use by inline functions) 00074 // 00075 00076 #include "receiver.h" 00077 00078 // 00079 // IMPLEMENTATION of inline functions (and needed classes) 00080 // 00081 00082 00083 00088 inline void 00089 Preemption::set_receiver(Receiver *receiver) 00090 { 00091 // Dequeue from old preempter's sender list 00092 if (_receiver) 00093 sender_dequeue (_receiver->sender_list()); 00094 00095 // Set new preempter 00096 _receiver = receiver; 00097 00098 // If there is already a pending event, enqueue in preempter's sender list 00099 if (pending()) 00100 preempter_enqueue(); 00101 } 00102 00103 00108 inline Sched_context * 00109 Preemption::pending() const 00110 { 00111 return _pending; 00112 } 00113 00114 00119 inline void 00120 Preemption::set_pending(Sched_context *const sched) 00121 { 00122 _pending = sched; 00123 } 00124 00125 #endif // preemption_h