Hello,
I am building an application based on the TI RTOS tcpEcho example where the tcpWorker task, upon being called, posts a semaphore that then enabled another application task to run. For the sake of the exercise I've made the called application task contain an infinite loop (the task never completes.) I want to know how to make it such that the tcpWorker task can preempt the application task while the application task is running. I've made my application task have priority 1 in the config file but the tcpWorker task still never runs while the applicatoin task is running. What do I need to do to make tcpWorker preempt the application task? (see code snippets below.)
Void tcpWorker(UArg arg0, UArg arg1) { int clientfd = (int)arg0; int bytesRcvd; int bytesSent; char buffer[TCPPACKETSIZE]; System_printf("tcpWorker: start clientfd = 0x%x\n", clientfd); Semaphore_post(semaphore0); while ((bytesRcvd = recv(clientfd, buffer, TCPPACKETSIZE, 0)) > 0) { bytesSent = send(clientfd, buffer, bytesRcvd, 0); if (bytesSent < 0 || bytesSent != bytesRcvd) { System_printf("Error: send failed.\n"); break; } } System_printf("tcpWorker stop clientfd = 0x%x\n", clientfd); close(clientfd); } //...... void Task_0_Fxn(void){ while(1){ Semaphore_pend(semaphore0, BIOS_WAIT_FOREVER); while(1){ //... } } }
Thank you