Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

HALTing a task is like a sudden power outage for the task. The HALTed task doesn't know it's coming, and can't get its affairs in order before it goes down. A safer and more robust approach for stopping tasks is to request the task to end itself. 

For example, suppose VARB35 must be set to enable Task 4, and the controlling task may stop Task 4 by clearing VARB35. The program in Task 4 would qualify each atomic (atomic means not to be interrupted or aborted) block of code with VARB35 and look like:

WHILE (VARB35 = B1)

		
			;some fast code

		
			IF (VARB35 = B1)

		
				;some atomic code

		
			NIF

		
			TIMST0

		
			WHILE (TIM < 100 AND VARB35=B1)	;dwell while still enabled

		
			NWHILE				;end of qualified dwell

		
			IF (VARB35 = B1)

		
				;more atomic code

		
			NIF

		
		NWHILE					;end of main task loop

		
		;end of task cleanup code, graceful exit

		
		END

		
  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.