Welcome, Guest. Please login or register.

Author Topic: Intuition Loops  (Read 3140 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline nyteschaydeTopic starter

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 643
    • Show all replies
    • http://www.nyteshade.com
Intuition Loops
« on: January 24, 2017, 05:30:58 PM »
So, typically, there is a line in many Intuition loops that looks as follows:

Code: [Select]
Wait (1 << mywin->UserPort->mp_SigBit);

I presume that this is telling the OS that it shouldn't spend cycles on this code until a signal is sent via the window's UserPort via the mp_SigBit. This is typically important since this code is usually in a while(true) or while(trueUntilFlagSet) loop which could easily hog the CPU.

My questions are:

  • Are my assumptions about the functionality correct?
  • What is the significance of using bit shift operator here. Why 1 << mp_SigBit? Are there other values or messages that are potentially encoded in that signal? What would they be? How can we find them?
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline nyteschaydeTopic starter

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 643
    • Show all replies
    • http://www.nyteshade.com
Re: Intuition Loops
« Reply #1 on: January 25, 2017, 07:19:08 PM »
Thanks Thomas. You're my guru. So in this case, would you do something like the following if you wanted to wait for intuition based feedback *and* check for CTRL-C?

Code: [Select]
Wait(1 << mywin->UserPort->mp_SigBit | SIGBREAKF_CTRL_C);
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500