#### rt694157

Joined Dec 15, 2019
57

Given code in page

I am looking at example code, task could be set by priority

I do not understand code given in example, anybody know What the example of code explain ?

C:
void vAFunction( void )
{

// Create a task, storing the handle.

// ...

// Use the handle to raise the priority of the created task.
vTaskPrioritySet( xHandle, tskIDLE_PRIORITY + 1 );

// ...

// Use a NULL handle to raise our priority to the same value.
vTaskPrioritySet( NULL, tskIDLE_PRIORITY + 1 );
}

#### Papabravo

Joined Feb 24, 2006
15,092
You are making an assumption, that the function of a piece of code can be determined by looking at that piece of code in isolation. This is an illusion. Only by placing the code in context can its function and purpose be determined. Also we are not necessarily interested in picking this particular piece of software apart in excruciating detail just to answer your questions. Rather it seems like you are trying to shortcut the process rather than digging in and ferreting out the answers on your own.

The inclusion of // ... is curious. Does it indicate that you have abbreviated the actual code, or is the actual code written that way. As it appears, the function makes no sense to me.

#### rt694157

Joined Dec 15, 2019
57
You are making an assumption, that the function of a piece of code can be determined by looking at that piece of code in isolation. This is an illusion. Only by placing the code in context can its function and purpose be determined. Also we are not necessarily interested in picking this particular piece of software apart in excruciating detail just to answer your questions. Rather it seems like you are trying to shortcut the process rather than digging in and ferreting out the answers on your own.
I have downloaded free rtos version 10.3 and after that I have run sample example on free rtos. I am trying to understand code, what is the work of each function. I started to read manual and given detail on the site of free rtos

Each task run according to their priority when we need to set the priority we will call to vTaskPrioritySet API

I looked function API vTaskPrioritySet that I didn't understand in the page

Edit:
consider there are three task that only print message

Task priority order : 1, 2, 3

Last edited:

#### 402DF855

Joined Feb 9, 2013
266
The example you've provided is taken from FreeRTOS's task.h and simply demonstrates how you change the priority of a task, either by providing a handle to a task, or NULL if changing the priority of the currently running task.

#### rt694157

Joined Dec 15, 2019
57
The example you've provided is taken from FreeRTOS's task.h and simply demonstrates how you change the priority of a task, either by providing a handle to a task, or NULL if changing the priority of the currently running task.
I am reading the user manual of Free RTOS Also looking at some sample codes. When I was searching on the internet about free rtos, I found a sample code. https://github.com/maniacbug/FreeRTOS/blob/master/task.h I think it might be useful for me . This code is a bit difficult to understand

Can you give any suggestion how to understand this code in easy way, Where should i start from and how to proceed after a start ?

#### 402DF855

Joined Feb 9, 2013
266
Can you give any suggestion how to understand this code in easy way
Not really, it's a fairly complicated topic. I can only suggest that you study the examples and documentation. There is I believe a Windows port which may make it easier to work with the examples.