Skip to content

pt_wait - do not suspend if cond true on entry #4

@culyun

Description

@culyun

I'm probably missing something but why can't you:

#define pt_wait(pt, cond)                                                      \
 do {                                                                         \
    if ((cond)) {                                     \
      break;                                       \
    }                                                                             \
    pt_label(pt, PT_STATUS_BLOCKED);                                           \
    if (!(cond)) {                                                             \
      return;                                                                  \
    }                                                                          \
  } while (0)

This form would mimic the typical condition-variable signature, which typically does not block if the condition is true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions