[8 points]Here is the definition of a push() operation for a lock-free stack:
typedef struct node {
long key;
struct node *next;
struct node *mr_next; /* for limbo list */
} node_t;
/* Visible to all threads; initially NULL. */
node_t *stack_top;
void push (long t)
{
node_t *n = new_node ();
n->key = t;
do {
node->next = stack_top;
} while (!CAS(&stack_top, node, node->next));
}
CAS returns TRUE on success and FALSE on failure.
Write the corresponding pop() operation. Assume you have access to a
deferred deletion function free_node_later (node_t *), so you don't have to
worry about the ABA problem.