Example #1
0
int main()
{
    int i;
	/* Initialization Part */
	DosInit();
	TcbInitAll();
    /*TODO*/
    BufInitAll();
  
	/* Get access to the entry address of clock intrrupt */
	old_int8 = getvect(8);

    
    clrscr();
    
    tcbs[0].state = RUNNING;
    current = 0;    /* current thread */


    ThreadCreate(sndThdName,(codeptr)Sender,STACK_SIZE);
	ThreadCreate(recvThdName,(codeptr)Receiver,STACK_SIZE);
	
        
    setvect(8, new_int8);
    my_swtch();

    TcbState();
    while(!ThreadFinished());

    TcbState();
    setvect(8, old_int8); /* Recover old clock interrupt */

    ThreadDestory(0);
    return 0;
}
Example #2
0
int main()
{
    int i;
	/* Initialization Part */
	DosInit();
	TcbInitAll();
    BufInit(freebuf);
  
	/* Get access to the entry address of clock intrrupt */
	old_int8 = getvect(8);

    
    clrscr();
    
    tcbs[0].state = RUNNING;
    current = 0;    /* current thread */

    /* Init NumBuf*/
    for(i = 0; i < NUM_BUF_LEN; i++)
    {
        numBuf[i] = 0;
    }
    
    pIn = pOut = 0; /* out/in Index for numBuf */

    ThreadCreate("T1",(codeptr)T1Producer,STACK_SIZE);
	ThreadCreate("T2",(codeptr)T2Custemer,STACK_SIZE);
	
        
    setvect(8, new_int8);
    my_swtch();

    TcbState();
    while(!ThreadFinished());

    TcbState();
    setvect(8, old_int8); /* Recover old clock interrupt */

    ThreadDestory(0);
    return 0;
}
Example #3
0
int main()
{
	/* Initialization Part */
	DosInit();
	TcbInitAll();
    BufInit(freebuf);
  
	/* Get access to the entry address of clock intrrupt */
	old_int8 = getvect(8);

    /*
	printf("Please Input the Time Slice \n");
	scanf("%d",&timeSlice);

	printf("Press Any Key To Continue ......\n");
	getch();
    */
    
    clrscr();
    
    tcbs[0].state = RUNNING;
    current = 0;    /* current thread */
    sum = 0;

    ThreadCreate("T1",(codeptr)T1AddOne,STACK_SIZE);
	ThreadCreate("T2",(codeptr)T2AddTwo,STACK_SIZE);
	
        
    setvect(8, new_int8);
    my_swtch();

    TcbState();
    while(!ThreadFinished());

    TcbState();
    setvect(8, old_int8); /* Recover old clock interrupt */
    printf("End : Sum is %d \n",sum);
    ThreadDestory(0);
    return 0;
}
Example #4
0
void prog8051::ProgramClicked(void)
{
    if(HexFile->text() == "")
    {
        BrowseClicked();
        if(HexFile->text() == "")
        {
            QMessageBox::information(this,"ERROR","ERROR: I need a filename to proceed.");
            return;
        }
    }

    progthread = new progThread;
    connect(progthread,SIGNAL(Status(int)),this,SLOT(SetStatus(int)));
    connect(progthread,SIGNAL(Error(QString)),this,SLOT(Alerts(QString)));
    connect(progthread,SIGNAL(finished()),this,SLOT(ThreadFinished()));
    connect(progthread,SIGNAL(Info(QString)),this,SLOT(SetInst(QString)));

    progthread->Init(HexFile->text(),SerialPort->currentText(),Baudrate->currentText().toInt());
    progthread->start();
    ButtonsToggle(false);
}