Sha256: 7ddf7bfa120db7223d195118d62155a90e0ed5c94ab7a5e935150af9bbd814ad

Contents?: true

Size: 923 Bytes

Versions: 6

Compression:

Stored size: 923 Bytes

Contents

#include <byebug.h>

static locked_thread_t *locked_head = NULL;
static locked_thread_t *locked_tail = NULL;

extern int
is_in_locked(VALUE thread)
{
  locked_thread_t *node;

  if(!locked_head) return 0;

  for(node = locked_head; node != locked_tail; node = node->next)
  {
    if(node->thread == thread) return 1;
  }
  return 0;
}

extern void
add_to_locked(VALUE thread)
{
  locked_thread_t *node;

  if(is_in_locked(thread)) return;

  node = ALLOC(locked_thread_t);
  node->thread = thread;
  node->next = NULL;
  if(locked_tail)
    locked_tail->next = node;
  locked_tail = node;
  if(!locked_head)
    locked_head = node;
}

extern VALUE
remove_from_locked()
{
  VALUE thread;
  locked_thread_t *node;

  if(locked_head == NULL)
    return Qnil;

  node = locked_head;
  locked_head = locked_head->next;
  if(locked_tail == node)
    locked_tail = NULL;
  thread = node->thread;
  xfree(node);
  return thread;
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
byebug-1.1.0 ext/byebug/locker.c
byebug-1.0.3 ext/byebug/locker.c
byebug-1.0.2 ext/byebug/locker.c
byebug-1.0.1 ext/byebug/locker.c
byebug-1.0.0 ext/byebug/locker.c
byebug-0.0.1 ext/byebug/locker.c