예제 #1
0
static void
release_resource (CcnetProcessor *processor)
{
    release_thread (processor);

    CCNET_PROCESSOR_CLASS(seafile_recvblock_v2_proc_parent_class)->release_resource (processor);
}
예제 #2
0
파일: exit.c 프로젝트: shattered/linux-m68k
void release(struct task_struct * p)
{
	int i;

	if (!p)
		return;
	if (p == current) {
		printk("task releasing itself\n");
		return;
	}
	for (i=1 ; i<NR_TASKS ; i++)
		if (task[i] == p) {
			nr_tasks--;
			task[i] = NULL;
			REMOVE_LINKS(p);
			release_thread(p);
			if (STACK_MAGIC != *(unsigned long *)p->kernel_stack_page)
				printk(KERN_ALERT "release: %s kernel stack corruption. Aiee\n", p->comm);
			free_kernel_stack(p->kernel_stack_page);
			current->cmin_flt += p->min_flt + p->cmin_flt;
			current->cmaj_flt += p->maj_flt + p->cmaj_flt;
			current->cnswap += p->nswap + p->cnswap;
			kfree(p);
			return;
		}
	panic("trying to release non-existent task");
}
예제 #3
0
/*
 *	Will release a thread if needed, otherwise will just increment
 *	  the semaphore's value
 *
 *	@Param  - Pointer to the semaphore that is being signaled
 */
void mysem_signal(Semaphore* sem){
	DISABLE_INTERRUPTS();
	sem->value++;
	if(sem->value <= 0){
		mythread_unblock(release_thread(sem));
		mysem_printQueue(sem);
	}
	ENABLE_INTERRUPTS();
}
예제 #4
0
파일: SlipThread.c 프로젝트: jenyckee/SLIP
static NIL_type flush_thread(NIL_type)
  { THR_type next_thread,
             thread;
    for (thread = Thread_Current;
         !is_NUL(thread);
         thread = next_thread)
      { next_thread = thread->thr;
        release_thread(thread); }
    Thread_Current = Main_Empty_Thread; }
예제 #5
0
static void
release_resource (CcnetProcessor *processor)
{
    SeafileGetblockV2Proc *proc = (SeafileGetblockV2Proc *)processor;

    release_thread (processor);
    descruct_bitfield (&proc->block_bitmap, &proc->active, proc->tx_task);

    CCNET_PROCESSOR_CLASS(seafile_getblock_v2_proc_parent_class)->release_resource (processor);
}
예제 #6
0
파일: SlipThread.c 프로젝트: jenyckee/SLIP
THR_type Thread_Poke(NBR_type Thread_id,
                     EXP_type Call_status,
                     UNS_type Size)
  { THR_type thread;
    thread = Thread_Current->thr;
    release_thread(Thread_Current); 
    Thread_Current = acquire_thread(Size,
                                    Thread_id,
                                    thread,
                                    Call_status);
    return Thread_Current; }
예제 #7
0
static void release_task(struct task_struct * p)
{
    if (p != current) {
#ifdef CONFIG_SMP
        /*
         * Wait to make sure the process isn't on the
         * runqueue (active on some other CPU still)
         */
        for (;;) {
            task_lock(p);
            if (!task_has_cpu(p))
                break;
            task_unlock(p);
            do {
                cpu_relax();
                barrier();
            } while (task_has_cpu(p));
        }
        task_unlock(p);
#endif
        atomic_dec(&p->user->processes);
        security_task_free(p);
        free_uid(p->user);
        unhash_process(p);

        release_thread(p);
        current->cmin_flt += p->min_flt + p->cmin_flt;
        current->cmaj_flt += p->maj_flt + p->cmaj_flt;
        current->cnswap += p->nswap + p->cnswap;
        /*
         * Potentially available timeslices are retrieved
         * here - this way the parent does not get penalized
         * for creating too many processes.
         *
         * (this cannot be used to artificially 'generate'
         * timeslices, because any timeslice recovered here
         * was given away by the parent in the first place.)
         */
        current->counter += p->counter;
        if (current->counter >= MAX_COUNTER)
            current->counter = MAX_COUNTER;
        p->pid = 0;
        free_task_struct(p);
    } else {
        printk("task releasing itself\n");
    }
}
예제 #8
0
static void release_task(struct task_struct * p)
{
	if (p == current)
		BUG();
#ifdef CONFIG_SMP
	wait_task_inactive(p);
#endif
	atomic_dec(&p->user->processes);
	free_uid(p->user);
	unhash_process(p);

	release_thread(p);
	current->cmin_flt += p->min_flt + p->cmin_flt;
	current->cmaj_flt += p->maj_flt + p->cmaj_flt;
	current->cnswap += p->nswap + p->cnswap;
	sched_exit(p);
	p->pid = 0;
	free_task_struct(p);
}
예제 #9
0
파일: exit.c 프로젝트: benbee/Learning
void release(struct task_struct * p)
{
	if (p != current) {
#ifdef __SMP__
		/*
		 * Wait to make sure the process isn't active on any
		 * other CPU
		 */
		for (;;)  {
			int has_cpu;
			spin_lock_irq(&runqueue_lock);
			has_cpu = p->has_cpu;
			spin_unlock_irq(&runqueue_lock);
			if (!has_cpu)
				break;
			do {
				barrier();
			} while (p->has_cpu);
		}
#endif
		free_uid(p);
		add_free_taskslot(p->tarray_ptr);

		write_lock_irq(&tasklist_lock);
		nr_tasks--;
		unhash_pid(p);
		REMOVE_LINKS(p);
		write_unlock_irq(&tasklist_lock);

		release_thread(p);
		current->cmin_flt += p->min_flt + p->cmin_flt;
		current->cmaj_flt += p->maj_flt + p->cmaj_flt;
		current->cnswap += p->nswap + p->cnswap;
		free_task_struct(p);
	} else {
		printk("task releasing itself\n");
	}
}
예제 #10
0
파일: SlipThread.c 프로젝트: jenyckee/SLIP
NIL_type Thread_Zap(NIL_type)
  { THR_type thread;
    thread = Thread_Current;
    Thread_Current = thread->thr;
    release_thread(thread); }