[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about the capabilities of gawk extensions
From: |
Andrew J. Schorr |
Subject: |
Re: Question about the capabilities of gawk extensions |
Date: |
Tue, 11 Jun 2024 08:43:58 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi,
Please take a look at the existing "select" extension which
already implements a means for trapping signals, but it
requires you to use a select loop as your control structure,
which could be fine if you're multiplexing. Here's the man page:
https://gawkextlib.sourceforge.net/select/select.3am.html
Otherwise, I don't think you can do this. Even if you could call a gawk
function from an extension, which I don't think you can, I suspect that it
wouldn't work from an asynchronous signal handler. By using the select
function, you can make everything synchronous and perhaps accomplish your goal.
Regards,
Andy
On Mon, Jun 10, 2024 at 07:51:45PM -0700, Ari Abrams wrote:
> Hello,
>
> I essentially just want to confirm that there isn't a way to do what I am
> trying to do with a gawk extension. What I am trying to do is implement
> custom signal handling in gawk. I was pointed to this email from a Stack
> Overflow post I made which I will link at the end. After reading the gawk
> extension documentation, I have not found a way to call user defined gawk
> functions from an extension. This would be necessary for signal handling
> since the user would need to somehow register a gawk function as a callback
> to be called when the process receives a signal. Is this at all possible?
>
> Stack Overflow post
> <https://stackoverflow.com/questions/78600368/how-to-call-user-defined-gawk-functions-from-a-gawk-c-extension>
>
> Thanks.