You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are attempting to run the signal example provided below using the latest versions of Wasix and Wasmer (Wasmer 5.0.4). However, the example is not functioning as expected; it gets stuck in the while loop and keeps printing 'running...'.
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
volatile int run = 1; // set to 0 when SIGINT is caught
/*
* Signal handler function.
* It is called when a signal is delivered to the process.
*/
void sig_handler(int signo)
{
// SIGHUP is sent when user closes the terminal
if (signo == SIGHUP)
{
run = 0; // set to 0 to terminate the program
printf("received SIGHUP\n");
}
// SIGINT is sent when user presses Ctrl+C
if (signo == SIGINT)
{
run = 0; // set to 0 to terminate the program
printf("received SIGINT\n");
}
}
int main(void)
{
if (signal(SIGINT, sig_handler) == SIG_ERR)
printf("\ncan't catch SIGINT\n");
if (signal(SIGHUP, sig_handler) == SIG_ERR)
printf("\ncan't catch SIGHUP\n");
/*
* Raise a SIGHUP signal.
*/
raise(SIGHUP);
// A long long wait so that we can easily issue a signal to this process
while (run)
{
printf("running...\n");
sleep(1); // sleep for 1 second
}
return 0;
}
Any insights or suggestions would be greatly appreciated!
The text was updated successfully, but these errors were encountered:
Hi Wasmer community,
We are attempting to run the signal example provided below using the latest versions of Wasix and Wasmer (Wasmer 5.0.4). However, the example is not functioning as expected; it gets stuck in the while loop and keeps printing 'running...'.
Any insights or suggestions would be greatly appreciated!
The text was updated successfully, but these errors were encountered: