[Swan-dev] pexpect() and passert() from a thread

Andrew Cagney andrew.cagney at gmail.com
Mon Aug 31 13:58:20 UTC 2020


On Fri, 21 Aug 2020 at 13:10, Andrew Cagney <andrew.cagney at gmail.com> wrote:
>
> FYI,
> Currently if there's a pexpect() or passert() in a helper thread
> there's no context (state prefix) so it's not easy to proportion
> blame.  Going forward (when cur_* are deleted) the main thread will
> have the same problem.
> However, with loggers pretty much available everywhere, its possible
> to pass the logger into these macros.  I'm wondering about the best
> strategy ... so I'll throw out two suggestions:
>
> Plan A)
> rename pasert() - passert_global() (or PASSERT? or ...)
> add passert(LOGGER, CONDITION) (or is that passert(CONDITION, LOGGER)
> this way the familiar name remains, but it gains a parameter

I think I'll start by renaming the existing passert()/pexpect() to
PASSERT()/PEXPECT().

> Plan B)
> add new PASSERT(LOGGER, CONDITION) and leave existing passert() alone
> I suspect new code will continue to use the old passert()
>
> Plan C)
> some combination of the above


More information about the Swan-dev mailing list