FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [September 2006 Threads] Task communication, lwIP.Posted by Nobody/Anonymous on September 11, 2006 Hi, I need to make following thing: First task is waiting on lwIP socket for commands, and second task is waiting on second lwIP socket. When I get a "start sending" command on socket 1 (first task), I want to start sending data on socket 2 (second task). And when I get a "stop sending" command, I want to stop sending data. The question is: If I use a global variable which is changed only by task 1, and read by task 2, do I need to use critical section? Changing a variable is probably done in one assembler command, am I right?(portCHAR on 32-bit ARM7) Also, is there any better way to synchronize these two task? Semaphore doesnt fit well here I think, because I dont want the task 2 to take it, it only needs to read the flag to send or not.
Second question: is there any way not to block task when waiting on packet in lwIP? I want to send data continously and also check for commands from another side.
And third: can two tasks work with one lwip socket connection? For example: one sends and one waits for commands.
Please help ;]
RE: Task communication, lwIP.Posted by Nobody/Anonymous on September 11, 2006 Q1 - A critical section is only required is both tasks change the variable. If only one task writes to the variable and the variable is of the natural width of the machine (32bit for arm7) then you are fine without. You can also use a semaphore for synchronization having the task 2 take the semaphore but never give it, and task 1 give the semaphore but never take it. Many people ignore this method of using semaphores, check out the uIP examples for this method.
Q2 - Not too familiar with lwIP but normally with berkley sockets you can setup them up to be either blocking or non blocking before binding. Check the documentation.
Q3 - Don't know.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|