02.03.2014 Views

Tornado

Tornado

Tornado

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6<br />

Browser<br />

Figure 6-27<br />

At this point examining the code (not shown) may seem worthwhile. Doing so,<br />

you notice that uMed uses no shared resources, but uHi and uLow synchronize<br />

their work with a semaphore.<br />

Examining the semaphore with the browser (Figure 6-27) confirms the dawning<br />

suspicion: uHi is indeed blocking on the semaphore, which uLow cannot release<br />

because uMed has preempted it.<br />

uHi Blocked on Semaphore<br />

6<br />

Having diagnosed the problem as a classic priority inversion, the fix is<br />

straightforward. As described in VxWorks Programmer’s Guide: Basic OS, you can<br />

revise the application to synchronize uLow and uHi with a mutual-exclusion<br />

semaphore created with the SEM_INVERSION_SAFE option.<br />

6.13 Tcl: the Browser Initialization File<br />

When the browser begins executing, it first checks for a file called<br />

.wind/browser.tcl in your home directory. If this file exists, its contents are sourced<br />

as Tcl code.<br />

For example, it may be convenient to download object modules from the browser.<br />

The following browser.tcl code defines a button and a procedure to implement<br />

this.<br />

231

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!