Thread Sleep and Wakeup

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Sivaraj_A
Level 2
Level 2
5 likes given 10 replies posted 10 questions asked

Hi,

How do configure/code to make a thread into sleep mode and how do wake up from sleep mode to an active mode without affecting other threads? its not like cyclic.

the use case is,
(Considering GPIOAPP Example code as a reference)

During video streaming in UVC(active thread), the GPIO thread will be in a sleep state and whenever a GPIO Event(Button press) is received, the GPIO thread will wake up to blink the LED and again goes to a sleep state.

Or, is it possible on putting the GPIO thread in non-cyclic mode?

0 Likes
1 Solution
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

There are two APIs "CyU3PThreadSuspend" and "CyU3PThreadResume". These APIs can help to force suspend and resume threads whenever required.

Please refer to FX3 API doc in the FX3 SDK for further details on the APIs.

Note that calling thread suspend on an already suspended thread may result in failures, similar is the case for resuming the thread.

Best Regards,
AliAsgar

View solution in original post

2 Replies
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

There are two APIs "CyU3PThreadSuspend" and "CyU3PThreadResume". These APIs can help to force suspend and resume threads whenever required.

Please refer to FX3 API doc in the FX3 SDK for further details on the APIs.

Note that calling thread suspend on an already suspended thread may result in failures, similar is the case for resuming the thread.

Best Regards,
AliAsgar

Sivaraj_A
Level 2
Level 2
5 likes given 10 replies posted 10 questions asked

Okay will look into it.

0 Likes