Ejemplo n.º 1
0
static int
native_thread_create(rb_thread_t *th)
{
    size_t stack_size = 4 * 1024; /* 4KB */

    th->native_thread_data.interrupt_event = CreateEvent(0, TRUE, FALSE, 0);

    if ( !th->native_thread_data.interrupt_event)
    {
        DWORD dwErr = GetLastError();
        thread_debug("thread interrupt_event error: %d\n", dwErr );
    }

    th->thread_id = w32_create_thread(stack_size, thread_start_func_1, th);

    if ((th->thread_id) == 0) {
	    st_delete_wrap(th->vm->living_threads, th->self);

        if ( th->native_thread_data.interrupt_event )
            w32_close_handle(th->native_thread_data.interrupt_event);

	    rb_raise(rb_eThreadError, "can't create Thread (%d)", errno);
    }

    w32_resume_thread(th->thread_id);

    if (THREAD_DEBUG) {
	Sleep(0);
	thread_debug("create: (th: %p, thid: %p, intr: %p), stack size: %d\n",
		     th, th->thread_id,
		     th->native_thread_data.interrupt_event, stack_size);
    }
    return 0;
}
Ejemplo n.º 2
0
static int
native_thread_create(rb_thread_t *th)
{
    size_t stack_size = 4 * 1024; /* 4KB */
//RHO
    th->native_thread_data.interrupt_event = CreateEvent(0, TRUE, FALSE, 0);

    if ( !th->native_thread_data.interrupt_event)
    {
        DWORD dwErr = GetLastError();
        thread_debug("thread interrupt_event error: %d\n", dwErr );
    }
//RHO
    th->thread_id = w32_create_thread(stack_size, thread_start_func_1, th);

    if ((th->thread_id) == 0) {
//RHO
		if ( th->native_thread_data.interrupt_event )
            w32_close_handle(th->native_thread_data.interrupt_event);
//RHO				
		return thread_errno;
    }

    w32_resume_thread(th->thread_id);

    if (THREAD_DEBUG) {
	Sleep(0);
	thread_debug("create: (th: %p, thid: %p, intr: %p), stack size: %d\n",
		     th, th->thread_id,
		     th->native_thread_data.interrupt_event, stack_size);
    }
    return 0;
}
Ejemplo n.º 3
0
void
rb_thread_create_timer_thread(void)
{
    if (timer_thread_id == 0) {
	timer_thread_id = w32_create_thread(1024, timer_thread_func, 0);
	w32_resume_thread(timer_thread_id);
    }
}
Ejemplo n.º 4
0
static void
rb_thread_create_timer_thread(void)
{
    if (timer_thread_id == 0) {
	if (!timer_thread_lock) {
	    timer_thread_lock = CreateEvent(0, TRUE, FALSE, 0);
	}
	timer_thread_id = w32_create_thread(1024 + (THREAD_DEBUG ? BUFSIZ : 0),
					    timer_thread_func, 0);
	w32_resume_thread(timer_thread_id);
    }
}
Ejemplo n.º 5
0
static int
native_thread_create(rb_thread_t *th)
{
    size_t stack_size = 4 * 1024; /* 4KB */
    th->thread_id = w32_create_thread(stack_size, thread_start_func_1, th);

    if ((th->thread_id) == 0) {
	return thread_errno;
    }

    w32_resume_thread(th->thread_id);

    if (THREAD_DEBUG) {
	Sleep(0);
	thread_debug("create: (th: %p, thid: %p, intr: %p), stack size: %d\n",
		     th, th->thread_id,
		     th->native_thread_data.interrupt_event, stack_size);
    }
    return 0;
}
Ejemplo n.º 6
0
static int
native_thread_create(rb_thread_t *th)
{
    size_t stack_size = 4 * 1024; /* 4KB */
    th->thread_id = w32_create_thread(stack_size, thread_start_func_1, th);

    if ((th->thread_id) == 0) {
	st_delete_wrap(th->vm->living_threads, th->self);
	rb_raise(rb_eThreadError, "can't create Thread (%d)", errno);
    }

    w32_resume_thread(th->thread_id);

    if (THREAD_DEBUG) {
	Sleep(0);
	thread_debug("create: (th: %p, thid: %p, intr: %p), stack size: %d\n",
		     th, th->thread_id,
		     th->native_thread_data.interrupt_event, stack_size);
    }
    return 0;
}