Sha256: 8c7664391945f9cdc23cbfab5f15d45beeb349fcbaa94d8bba4a9d11d981e74c

Contents?: true

Size: 1016 Bytes

Versions: 27

Compression:

Stored size: 1016 Bytes

Contents

#include <byebug.h>

typedef struct locked_thread_t {
  VALUE thread;
  struct locked_thread_t *next;
} locked_thread_t;

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

27 entries across 27 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/byebug-2.7.0/ext/byebug/locker.c
solidus_backend-1.0.0.pre2 vendor/bundle/gems/byebug-2.7.0/ext/byebug/locker.c
solidus_backend-1.0.0.pre vendor/bundle/gems/byebug-2.7.0/ext/byebug/locker.c
byebug-3.5.1 ext/byebug/locker.c
byebug-3.5.0 ext/byebug/locker.c
byebug-3.4.2 ext/byebug/locker.c
byebug-3.4.1 ext/byebug/locker.c
byebug-3.4.0 ext/byebug/locker.c
byebug-3.3.0 ext/byebug/locker.c
byebug-3.2.0 ext/byebug/locker.c
byebug-3.1.2 ext/byebug/locker.c
byebug-3.1.1 ext/byebug/locker.c
byebug-3.1.0 ext/byebug/locker.c
byebug-3.0.0 ext/byebug/locker.c
byebug-2.7.0 ext/byebug/locker.c
byebug-2.6.0 ext/byebug/locker.c
byebug-2.5.0 ext/byebug/locker.c
byebug-2.4.1 ext/byebug/locker.c
byebug-2.4.0 ext/byebug/locker.c
byebug-2.3.1 ext/byebug/locker.c