コード例 #1
0
ファイル: threads.c プロジェクト: fenghaitao/Harpoon
void transfer(struct thread_queue_struct * mthread)
#endif
{
#ifndef WITH_REALTIME_THREADS
  struct thread_list *tl;
  machdep_save_float_state(&(gtl->mthread));
  if (machdep_save_state(&(gtl->mthread))) {
    return;
  }
#else
  /* if the transfer thread is the current thread, just return */
#ifdef RTJ_DEBUG_THREADS
  printf("\nTransfer from %p to %p", currentThread, mthread);
  fflush(NULL);
#endif
  if(mthread == currentThread) {
    settimer();
    return;
  }

  /* if there is currently a thread running, save it's state */
  if(currentThread != NULL) {
    machdep_save_float_state(currentThread->mthread);
    if (machdep_save_state(currentThread->mthread)) {
#ifdef RTJ_DEBUG_THREADS
      printf(" returning directly!");
      fflush(NULL);
#endif
      return;
    }
  }
#endif

#ifndef WITH_REALTIME_THREADS
  tl=gtl;
  tl->prev->next=tl->next;
  tl->next->prev=tl->prev;
  if (tl!=tl->next) {
    gtl=gtl->next;
  } else {
    gtl=NULL;
  }
  
  if (ioptr!=NULL) {
    tl->next=ioptr;
    tl->prev=ioptr->prev;
    tl->next->prev=tl;
    tl->prev->next=tl;
  } else {
    ioptr=tl;
    tl->next=tl;
    tl->prev=tl;
  }
  startnext();
#else
  currentThread = mthread; //set the transfer thread to be the current thread
  restorethread(); //switch to it#
#endif
}
コード例 #2
0
ファイル: formephem.cpp プロジェクト: Sammalou/EUMETCastView
void FormEphem:: tlefilesread(QString str)
{

    QObject::disconnect(&downloadmanager, SIGNAL(finished(QString)), this, SLOT(tlefilesread(QString)));
    QObject::disconnect(&downloadmanager, SIGNAL(startnext(QString)), this, SLOT(showprogress(QString)));


    ui->edtUpdateTLE->setPlainText(ui->edtUpdateTLE->toPlainText() + "\n" + str);
    sats->ReloadList();
    showAvailSat();

}
コード例 #3
0
ファイル: formephem.cpp プロジェクト: Sammalou/EUMETCastView
void FormEphem::on_btnUpdateTLE_clicked()
{
    downloadmanager.clearqueue();

    ui->edtUpdateTLE->clear();

    ui->edtUpdateTLE->setPlainText("Start download \n");
    downloadmanager.append(opts.tlesources);
    QObject::connect(&downloadmanager, SIGNAL(finished(QString)), this, SLOT(tlefilesread(QString)));
    //QObject::connect(&downloadmanager, SIGNAL(progress(QString)), this, SLOT(showprogress(QString)));
    QObject::connect(&downloadmanager, SIGNAL(startnext(QString)), this, SLOT(showprogress(QString)));

}
コード例 #4
0
ファイル: threads.c プロジェクト: fenghaitao/Harpoon
void context_switch() {
  machdep_save_float_state(&(gtl->mthread));
  if (machdep_save_state(&(gtl->mthread))) {
    return;
  }
  if (ioptr!=NULL)
    {
      doFDs();
    }
  gtl=gtl->next;

  startnext();
}
コード例 #5
0
ファイル: _main.c プロジェクト: tyrantyr/onda_qnx
void
_main(void) {
	
	shdr = (struct startup_header *)boot_args.shdr_addr;

	board_init();

	setup_cmdline();

	cpu_startup();

	#define INIT_SYSPAGE_SIZE 0x600
	init_syspage_memory(ws_alloc(INIT_SYSPAGE_SIZE), INIT_SYSPAGE_SIZE);

	if(shdr->imagefs_paddr != 0) {
		avoid_ram(shdr->imagefs_paddr, shdr->stored_size);
	}

	main(_argc, _argv, envv);

	//
	// Tell the mini-drivers that the next time they're called, they're
	// going to be in the kernel. Also flip the handler & data pointers
	// to the proper values for that environment.
	//
	mdriver_hook();

	//
	// Copy the local version of the system page we've built to the real
	// system page location we allocated in init_system_private().
	//
	write_syspage_memory();

	//
	// Tell the AP's that that the syspage is now present.
	//
	smp_hook_rtn();

	startnext();
}
コード例 #6
0
ファイル: threads.c プロジェクト: fenghaitao/Harpoon
void exitthread() {
#ifndef WITH_REALTIME_THREADS
  struct thread_list *tl;
  /*LOCK ON GTL*/
  if (gtl!=gtl->next) {
    FNI_DestroyThreadState(gtl->jnienv);
    tl=gtl;
    gtl = gtl->next;
    gtl->prev=tl->prev;
    gtl->prev->next=gtl;

    /*perhaps free structures if we didn't have GC*/

    /*NEED LOCK AROUND THIS*/
    if (oldstack!=NULL) {
      __machdep_stack_free(oldstack);
      oldstack=NULL;
    }
    oldstack=tl->mthread.machdep_stack;

#ifdef WITH_REALTIME_JAVA
    RTJ_FREE(tl);
#else
    free(tl);
#endif
    DECREMENT_MEM_STATS(sizeof (struct thread_list));

    restorethread();
    return;
  } else {
    FNI_DestroyThreadState(gtl->jnienv);
    if (oldstack!=NULL) {
      __machdep_stack_free(oldstack);
      oldstack=NULL;
    }
    oldstack=gtl->mthread.machdep_stack;

#ifdef WITH_REALTIME_JAVA
    RTJ_FREE(gtl);
#else
    free(gtl);
#endif

    DECREMENT_MEM_STATS(sizeof (struct thread_list));
    gtl=NULL;
    startnext();
  }

#else // WITH_REALTIME_THREADS
  /* if no new thread has been set (by the end of thread_startup_routine) */
  //  puts("----------EXITING-------------");
  //  printf("CurrentThread is %p\n", currentThread);
  if(currentThread == NULL)
    longjmp(main_return_jump, 1); //jump back to main to clean up and end
  else {
#ifdef RTJ_DEBUG_THREADS
    printf("\nPrevious thread is dead, switching to %p", currentThread);
    fflush(NULL);
#endif
    restorethread(); //otherwise, restore the new thread
  }
#endif

}