468Lec03_SC_Concurrency

Notifysczerotime void procb waiteventa scevent

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: _B(){ wait(event_A); } sc_event event_A; } ECEN 468 Lecture 3 12 Risk of Notification without Delay SC_MODULE(iEvent){ SC_CTOR(iEvent){ SC_THREAD(proc_A); SC_THREAD(proc_B); SC_THREAD(proc_C); } sc_event event_A, event_B; void proc_A(){ while(true){ event_A.notify(); wait(event_B); } } void proc_B(){ while(true){ event_B.notify(); wait(event_A); } //Hidden forever loop } void proc_C(){ while(true){ wait(1, SC_NS); } } } ECEN 468 Lecture 3 13 Multiple Notifications of an Event An event may have multiple outstanding notifications Only the nearest time one takes effect sc_event iEvent; …… iEvent.notify(10, SC_NS); iEvent.notify(5, SC_NS);// Only this one stays iEvent.notify(15, SC_NS); …… ECEN 468 Lecture 3 14 Cancel an Event event_name.cancel(); Immediate events cannot be canceled ECEN 468 Lecture 3 15 Example of Event Notification …… sc_event sc_event action; sc_time now(sc_time_stamp()); action.notify(20, SC_MS); // Schedule...
View Full Document

This note was uploaded on 03/02/2014 for the course ECEN 468 taught by Professor Jianghu during the Spring '08 term at Texas A&M.

Ask a homework question - tutors are online