win32 simulator and blocking functions

rasty1 wrote on Sunday, June 30, 2019:

Hi,
I try to call OS functions from Win32 Simulator. Task in blocking call, like getchar() considered by RTOS as in "running"state.
Is it possible to tell to schduler that a task in “Blocking” state?

Best regards
Rasty

heinbali01 wrote on Sunday, June 30, 2019:

Rasty, the Windows demo indeed has a limitation: you are not allowed to do any Windows API call.
The problem is that when you call an API, the tasks ( = thread ) gets into a sleeping state. The FreeRTOS scheduler then allow the next task to become active.
When the API is finished, there is a risk of having 2 FreeRTOS tasks to become active at the same time.

I am wondering what happens if you temporarily stop the scheduler:

	vTaskSuspendAll();
	fprintf(outfile, "Done\n");
	xTaskResumeAll();

Could you try that?

rasty1 wrote on Sunday, June 30, 2019:

Hi Hein,
Did not work out :frowning:
Got semaphore timeout in defferent task.

I actually checked Win32 demos with sockets before asking this question, but did not see any code that tells kernel that recv() is going to block.

Need some specific API for Simulator, that tells kernel that task enters/leaves Blocking state.

This would be very useful for getchar()/gets() and socket operations.

Best regards
Rasty