Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the following piece of code do

Tags:

c

short rtimer_arch_now(void)
{
  short t1, t2;
  do {
    t1 = TA1R;
    t2 = TA1R;
  } while(t1 != t2);
  return t1;
}

TA1R is a The Timer_A Register. I still dont get why there is a loop. If they want to return the time whydont they simply return TA1R. What is the loop for?

like image 555
user2578666 Avatar asked Aug 06 '13 00:08

user2578666


People also ask

What does the following piece of code do in BST?

Explanation: In a postorder traversal, first the left child is visited, then the right child and finally the parent. 5. What does the following piece of code do? Explanation: In a preorder traversal, first the parent is visited, then the left child and finally the right child.

Who proposed threaded binary tree?

If a binary tree consists of n nodes then n+1 link fields contain NULL values. So in order to effectively manage the space, a method was devised by Perlis and Thornton in which the NULL links are replaced with special links known as threads. Such binary trees with threads are known as threaded binary trees.

Which of the following tree data structure is not a balanced binary tree?

Which of the following tree data structures is not a balanced binary tree? Explanation: All the tree data structures given in options are balanced, but B-tree can have more than two children.

Which of the following statements about a binary tree is correct?

The correct answer is option 3. Concept: Option 1: A binary tree is called a strictly binary tree if every non-leaf node of it has a non-empty left and right subtree. True, A binary tree is said to be strictly binary if every non-leaf node in it has nonempty left and right subtrees.


1 Answers

It tries to avoid the case when you ask the current time but it returns the value right before the time ticks. So it only returns the current time if the reading is stable.

like image 57
perreal Avatar answered Oct 30 '22 21:10

perreal