Sturk 1.0.2
Publish-subscribe C implementation.
Loading...
Searching...
No Matches
waitq.h File Reference

Waiting queue. More...

#include "st/os/sys.h"
#include "vx/vertegs.h"
Include dependency graph for waitq.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct StWaitq StWaitq
 Waiting queue.
 

Functions

StWaitqst_waitq_create (void)
 Create a new waiting queue.
 
void st_waitq_destroy (StWaitq *waitq)
 Destroy a waiting queue.
 
void st_waitq_ins (StWaitq *waitq, struct Vertegs *entry)
 Insert an entry into a waiting queue.
 
struct Vertegsst_waitq_rem (StWaitq *waitq)
 Remove an entry from the front of the queue.
 
struct Vertegsst_waitq_tryrem (StWaitq *waitq)
 Try to remove an entry from the front of the queue.
 

Detailed Description

Waiting queue.

Function Documentation

◆ st_waitq_create()

StWaitq * st_waitq_create ( void  )

Create a new waiting queue.

Returns
The new waiting queue.

◆ st_waitq_destroy()

void st_waitq_destroy ( StWaitq waitq)

Destroy a waiting queue.

Parameters
[in,out]waitqThe waiting queue.

◆ st_waitq_ins()

void st_waitq_ins ( StWaitq waitq,
struct Vertegs entry 
)

Insert an entry into a waiting queue.

Parameters
[in,out]waitqThe waiting queue.
[in,out]entryThe inserted entry.

◆ st_waitq_rem()

struct Vertegs * st_waitq_rem ( StWaitq waitq)

Remove an entry from the front of the queue.

Parameters
[in,out]waitqThe waiting queue.

This will block the thread if the queue is empty and wake it up only after an entry has been inserted.

Returns
The removed entry.

◆ st_waitq_tryrem()

struct Vertegs * st_waitq_tryrem ( StWaitq waitq)

Try to remove an entry from the front of the queue.

Parameters
[in,out]waitqThe waiting queue.

This will not block the thread.

Returns
The removed entry if the queue was not empty. Otherwise, NULL.