S
S
Sdelan_v_CCCP2014-09-19 13:28:16
linux
Sdelan_v_CCCP, 2014-09-19 13:28:16

Do linux processes/threads have a wait flag feature?

Hello! Interested in such a moment, is there a function in linux that suspends the execution of a process / thread until a certain flag is set.
Example from eCos:

#define OUR_EVENT_TYPE        0x1
//определение нашего флага
static cyg_flag_t   our_event;

//функция потока
void our_thread(cyg_addrword_t data)
{
while (1) {
      
           (void)cyg_flag_wait(&our_event, OUR_EVENT_TYPE ,CYG_FLAG_WAITMODE_OR | CYG_FLAG_WAITMODE_CLR);

//дальше что-то выполняется
...
}

In this code, after starting the thread, the cyg_flag_wait function pauses/waits until the our_event flag is set by the cyg_flag_setbits(&our_event, OUR_EVENT_TYPE) function.
Is there something similar in linux. Variants like start the process after some event occurs are not suitable, because after the while loop is executed, it again waits for the flag to be activated.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valentine, 2014-09-19
@Sdelan_v_CCCP

It's called mutexes .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question