TAILIEUCHUNG - HandBooks Professional Java-C-Scrip-SQL part 203

Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 203', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | public Timer Timer int start unsigned int nMilliseconds TimerType OneShot int waitfor void cancel TimerState state TimerType type unsigned int length Mutex pMutex unsigned int count Timer pNext private static void interrupt Interrupt This pointer is initialized each time a software timer is created by the constructor. And thereafter whenever a timer object is started its mutex is taken as follows Method start Description Start a software timer based on the tick from the underlying hardware timer. Notes This version is ready for multitasking. Returns 0 on success -1 if the timer is already in use. int Timer start unsigned int nMilliseconds TimerType timerType if state Idle return -1 Take the mutex. It will be released when the timer expires. pMutex- take Initialize the software timer. state Active type timerType length nMilliseconds MS_PER_TICK Add this timer to the active timer list. this return 0 start By taking the mutex when the timer is started we guarantee that no task not even the one that started this timer will be able to take it again until the same mutex is released. And that won t happen until either the timer expires naturally via the interrupt service routine or the timer is canceled manually via the cancel method . So the polling loop inside waitfor can be replaced with pMutex- take as follows Method waitfor Description Wait for the software timer to finish. Notes This version is ready for multitasking. Returns 0 on success -1 if the timer is not running. int Timer waitfor if state Active return -1 Wait for the timer to expire. pMutex- take Restart or idle the timer depending on its type. if type Periodic state Active this else pMutex- release state Idle return 0 waitfor When the timer does eventually expire the interrupt service routine will release the mutex and the calling task will awake inside waitfor. In the process of waking the mutex will already be taken for the next run of the timer. The mutex need only be

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.