Module: Groonga::Thread

Defined in:
ext/groonga/rb-grn-thread.c

Class Method Summary collapse

Class Method Details

.limitInteger

Returns the max number of threads. 0 means that thread isn’t supported.

Returns:

  • (Integer)

    the max number of threads. 0 means that thread isn’t supported.

Since:

  • 5.0.5



37
38
39
40
41
42
43
44
45
# File 'ext/groonga/rb-grn-thread.c', line 37

static VALUE
rb_grn_thread_s_get_limit (VALUE self)
{
    uint32_t limit;

    limit = grn_thread_get_limit();

    return UINT2NUM(limit);
}

.limit=(new_limit) ⇒ void

This method returns an undefined value.

Sets the max number of threads.

Parameters:

  • new_limit (Integer)

    The new max number of threads.

Since:

  • 5.0.5



58
59
60
61
62
63
64
65
66
67
# File 'ext/groonga/rb-grn-thread.c', line 58

static VALUE
rb_grn_thread_s_set_limit (VALUE self, VALUE rb_new_limit)
{
    uint32_t new_limit;

    new_limit = NUM2UINT(rb_new_limit);
    grn_thread_set_limit(new_limit);

    return Qnil;
}

.limit_getter=(getter) ⇒ void

This method returns an undefined value.

Sets a callable object that returns the max number of threads.

Parameters:

  • getter (#call)

    Callable object that returns the max number of threads.

Since:

  • 5.0.5



92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'ext/groonga/rb-grn-thread.c', line 92

static VALUE
rb_grn_thread_s_set_limit_getter (VALUE self, VALUE rb_getter)
{
    rb_iv_set(self, "@limit_getter", rb_getter);

    if (NIL_P(rb_getter)) {
        grn_thread_set_get_limit_func(NULL, NULL);
    } else {
        grn_thread_set_get_limit_func(rb_grn_thread_get_limit_func,
                                      (void *)rb_getter);
    }

    return Qnil;
}

.limit_setter=(setter) ⇒ void

This method returns an undefined value.

Sets a callable object that sets the max number of threads.

Parameters:

  • setter (#call)

    Callable object that sets the max number of threads.

Since:

  • 5.0.5



127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'ext/groonga/rb-grn-thread.c', line 127

static VALUE
rb_grn_thread_s_set_limit_setter (VALUE self, VALUE rb_setter)
{
    rb_iv_set(self, "@limit_setter", rb_setter);

    if (NIL_P(rb_setter)) {
        grn_thread_set_set_limit_func(NULL, NULL);
    } else {
        grn_thread_set_set_limit_func(rb_grn_thread_set_limit_func,
                                      (void *)rb_setter);
    }

    return Qnil;
}