7,609 questions
Best practices
1
vote
1
replies
91
views
Should I use null or undefined as a default starting value for my signal?
Basically given the following context, what is the best practice?
signal<MyCustomType | null>(null)
signal<MyCustomType | undefined>(undefined)
According to Null vs. Undefined :
...
Advice
1
vote
6
replies
183
views
<Low level Linux specific C> Need to make a signal jump to a label instead of performing a function call for the signal handler
I am writing a C program where I have many tasks to perform periodically (every second). There can be less CPU threads available than the number of tasks. I can just create a separate thread for each ...
0
votes
1
answer
170
views
Correct way to handle Ctrl-C in Python on Linux
Multiple pages on the Internet, including answers to this SO question and this page from a training company, say that you should handle Ctrl-C in python with code similar to:
import signal
import sys
...
Best practices
0
votes
4
replies
128
views
Migration from Reactive Forms to Signal Forms bottom-up
Currently, we need to migrate all Reactive Forms forms in the project to the new Angular 21+ Signal Forms. The form is very complex, multi-level, with FormGroups within FormGroups, etc. Therefore, we'...
1
vote
2
answers
174
views
Why is using pthread_mutex_trylock (with pthread_cond_wait) inside a signal handler fail to protect the critical section?
I modified my previous question in order to more focus.
I am investigating a race condition in a legacy multi-threaded application and would like to understand if our findings point to the root cause.
...
0
votes
2
answers
146
views
Extend signal form's FormField directive
Just learning signal forms and I'm trying to extend the functionality of the new FormField directive in angular 21 to add some custom classes to show valid/invalid states on my input.
So, here's what ...
0
votes
2
answers
103
views
Multiple instances of angular component react to changes from other instances
I have a moderately sized angular app with an edit control (edit, save, cancel) used throughout the app that controls permissions, view state/etc. There can be multiple instances of this component in ...
Best practices
0
votes
2
replies
65
views
One signal vs. multiple derived signals for complex api responses?
I’m working on a project using Angular 17+ Signals and I’m looking for some advice on the best way to expose data from a service to multiple different forms.
I have an API that returns a settings ...
0
votes
0
answers
77
views
fish shell trap (or --on-signal function) triggers but only when using stdin
Maybe I'll rewrite this to python as I understand the error handling in there a bit better but I'm curious why the behavior is different when it's running as a pipeline vs not:
function args.or.stdin
...
0
votes
1
answer
109
views
SIGCHLD handling in multi-threaded Python applications
According to the Python documentation, the signal.signal call can only be called from the main thread, and signal handlers will run in the main thread. to my understanding, unless the signal handler ...
3
votes
1
answer
121
views
Angular Signals: effect() error when used in afterNextRender
Complete error : effect() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with runInInjectionContext
I have a simple ...
-1
votes
1
answer
88
views
Lifecycle Management: Safely Unsubscribing from HttpClient in Root-Provided Angular Signal Services [closed]
I am implementing a modern state management pattern in Angular (version 16+) where a dedicated service acts as a state facade, integrating traditional RxJS asynchronous operations with the new Signals ...
2
votes
2
answers
96
views
Race condition between signal and pthread_cond_wait
Given
volatile int stopping = 0;
void handler(int) {
stopping = 1;
}
int main(int, char **) {
pthread_sigmask(BLOCK, [INT], ...);
pthread_create();
pthread_sigmask(UNBLOCK, [INT], ......
0
votes
1
answer
80
views
Monitor sigprocmask calls with Syscall User Dispatch?
I'm using prctl(PR_SET_SYSCALL_USER_DISPATCH, ...) to enable Syscall User Dispatch with a SIGSYS handler that gets called when the application issues any syscall. The prctl() call also marks the code ...
-1
votes
1
answer
116
views
Spectral Leakage in Resampled FFT (and how to fix it)
I have a 10 second signal of a pure 50 Hz sine wave sampled at 40.96 kSa/s (409,600 samples). I apply a Hanning window and the magnitude plot of my (numpy) FFT shows (ignoring negative image ...
1
vote
0
answers
60
views
Angular table fails to update after CRUD success
My app uses a facade service (singleton injectable) with signals for state management and RxJS for API calls.
I'm experiencing an inconsistent UI update problem with a table after a successful create ...
0
votes
1
answer
143
views
strange pthread and posix signal application behaviour
I'm having troubles understanding the behaviour of the following application.
There are 3 threads:
worker thread with an infinite loop which locks the mutex, modifies a global variable but in the end ...
0
votes
1
answer
174
views
Why do the values in the labels keep changing as the candle moves?
I have some signals that are generated through logic within my indicator. They are plotted as “dots, triangles, or arrows” or other shapes. What I wanted was a way to “monitor” the indicator signals. ...
1
vote
1
answer
120
views
Understanding behavior of DBus with respect to killing the process that used DBus to register a name
Take this simple program in Haskell
{-# LANGUAGE OverloadedStrings #-}
import Control.Exception (finally)
import Control.Monad (forever)
import Xmobar (tenthSeconds)
import DBus.Client
startServer' :...
1
vote
1
answer
123
views
Catch mouse enter and leave signals from AppplicationWindow in GTK4 Python
I'm creating a Gtk4 app in python 3 and I want to trigger a state change when the user mouses over the ApplicationWindow but I'm banging my head against a wall trying to figure out what signal string ...
5
votes
1
answer
93
views
Why it is not possible to trap SIGQUIT in Bash in docker build?
Kindly consider the following dockerfile that uses bash image and runs a bash to trap QUIT and then shows that QUIT trap. It should show the string "something".
ARG VERSION=latest
FROM bash:$...
1
vote
1
answer
166
views
futex_wait inside a signal handler
So I am trying to understand if I am missing anything about calling futex_wait inside a signal handler for a SIGSEGV access violation. Ostensibly, it is not on the list of async-signal-safe calls, ...
0
votes
1
answer
156
views
NgRx computed not Update Value when used in NgRx Store
I have a computed in my signal store, which should react on a value change but it just fires 1 time at creating and not when signal values are changing
const initialData = {
gridItems: [] as ...
2
votes
1
answer
130
views
`pthread_kill` randomly send signal to the wrong thread on MacOS
I have multiple threads performing sigwait on the same signal, and the main thread will wake specific thread up via pthread_kill. On Linux the program runs fine, but on MacOS the wrong thread will be ...
5
votes
2
answers
292
views
Signal handling in multi-threaded scenario [closed]
I'm trying to revive Hemlock, which now appears abandoned (original author has been absent for some time now). Mostly this has been a straightforward process of clearing out the bit rot, but I'm now ...
0
votes
0
answers
28
views
fastapi workers die in add_basemap
I have a problem with add_basemap from contextily. (I'm new to this to be honest)
I use fastapi in docker with workers=4, and contextily to make images.
In random time it die add_basemap (I don't know ...
1
vote
0
answers
110
views
Unable to build Signal's libsignal-protocol using wasm-pack – aes-gcm-siv version conflict and crate-type issues
I'm attempting to build the libsignal project using wasm-pack to target WebAssembly for a frontend integration. Specifically, I'm trying to build the libsignal-protocol crate individually rather than ...
0
votes
1
answer
60
views
QSocketNotifier stops triggering signals while in modal dialog in QT5
I have a client server app where things can happen asynchron, including the server disconnecting and reconnecting. The app has a LED indicator (label with green/red icon) that shows the server ...
1
vote
1
answer
88
views
ctrl-C to terminate a pyqt application with a QOpenGLWidget
My main file for a pyqt application looks like this:
#!/usr/bin/env python3
from PyQt5.QtWidgets import QApplication
import signal
import sys
from main_window import MainWindow
if __name__ == "...
5
votes
1
answer
159
views
Create a detached process in linux (shell) to avoid an uncatchable signal
Context : I am making my own cloud save manager for my non steam games, I am in the process of implementing a wrapper that launches games but also loads file from the cloud before opening and when you ...
3
votes
0
answers
311
views
Subscribe or callback on Signal store method?
I want to make a redirect after executing API request (on success) in signal store method.
I have 3 "solutions":
Use callback, but I don't feel it.
Use rxMethod, patch state within ...
1
vote
1
answer
548
views
Is there a way to dynamically compute rxResource() or resource() in Angular (19)
Our use case: in a component, we compute queries for data that should be fetched based on some config. I tried creating rxResource() within a compute to get the data - but also loading status and ...
3
votes
1
answer
80
views
Why is sigaction sending the the raised signal ID twice?
The signal handler passed in sa_sigaction to sigaction receives an int signal id as parameter, but the context info received as second parameter contains the signal id as field again.
Is there a good ...
2
votes
1
answer
116
views
Why does only one SIGINT get queued while others are ignored during signal handling in C?
I'm testing Unix signal behavior in C and noticed something odd. When I press Ctrl+C (sending SIGINT) multiple times quickly while the handler is still running (it sleeps for 3 seconds), only two ...
1
vote
1
answer
300
views
How to notify component that signal store encountered error in service while saving data?
I'm using a signal store as follows. It works as supposed to, except for the error handling. The initial load works correctly and communicates the error to the consuming component.
However, there ...
1
vote
1
answer
179
views
How do I use a drop down to change field in Vega visualization
In Vega or Vega lite, I want to create a stacked area chart where I can change the field used to color the visualization. Here is an example visualization. In this example, I would like to be able ...
0
votes
1
answer
305
views
How do I set an empty array as default value in toSignal?
I have a DataHandler service that calls a database service and returns the value to the calling component. The database service returns an observable of an array, while I'd like the data handler to ...
0
votes
2
answers
287
views
How do I safely put python signals into a queue?
I am working on a python3 script that handles signals (e.g. signal.SIGWINCH) by putting them in a queue. A separate thread puts user input into that same queue, which is all processed by my program's ...
0
votes
1
answer
58
views
Signal declaration in a separate class for use with QRunnable worker
I'm defining a Qt signal in a separate class derived from QObject for use in a QRunnable worker. The signal is emitted once by the worker as it completes. When creating two workers, the signal is ...
1
vote
1
answer
60
views
QML Keys.onDeletePressed not registering
I'm trying to handle a QML/JavaScript situation where the user presses the delete key. For some reason, Keys.onDeletePressed: {} is not firing. I am getting the signal for onEscapePressed, ...
0
votes
1
answer
298
views
How to trigger a method in one NgRx Signal Store when a property in another store updates?
I am working with NgRx Signal Store in an Angular project, and I need to make one store DashboardStore reactively call a method when a property in another store FilterSelectionStore updates.
Use Case:
...
4
votes
0
answers
100
views
async-signal safety of c++ classes
There is a limited number of functions that POSIX defines as async-signal safe.
See here.
This includes some fundamental functions such as write.
Since this is really a C standard (since unix is built ...
1
vote
1
answer
523
views
PySide6 signal not emitting properly when passed to decorator
I have this decorator in python 3.11 that sends a signal encoding the arguments to a function call that it decorates, here:
def register_action(signal=None):
def decorator(func):
def ...
2
votes
2
answers
294
views
In NGRX Signal Store, how can I call a method in a computed value?
In my store feature, if I define a method in the withMethods, then in the later defined withComputed, I can't seem to call one of these methods from a computed value. Is this supported?
0
votes
0
answers
111
views
Is it okay to declare a static array to use as a buffer inside a signal handler? - Printing inside a signal handler
I have an application where I need to print a some things to stdout and stderr inside a signal handler. The only safe way I can do this is with the write system call (I am on Linux). However, I am ...
1
vote
0
answers
192
views
Signal Store State Persistence Issue After Routing
Angular Signal Store state resets to initial values when navigating between components, despite being provided in 'root'. I'm using patchState to update the store. Why isn't the state persisting ...
0
votes
1
answer
75
views
Incorrect modeling of the spectrum of a sequence of pulse signals [closed]
I have a task to simulate a sequence of rectangular pulses. As a result, I wrote Python code, but the end results are not encouraging.
#!/bin/python
import numpy as np
from numpy.fft import fft
...
2
votes
1
answer
59
views
Why does if statement change my type definition? [duplicate]
I'm working on a self-guided exercise to learn about JS signals.
I'm following this blog post, but I'm trying to rewrite the code in TypeScript to better understand it.
While I've managed to get the ...
0
votes
0
answers
56
views
Delay in Restarting a High-Memory Process After Crash
Description:
I have a process that consumes a large amount of memory (+100GB RSS).
There's a usage by huge pages, but most of the memory is allocated in a naive way via malloc().
When this process ...
2
votes
1
answer
608
views
How to combine AbortController and AbortSignal?
To specify a timeout of a fetch request, we can use a AbortSignal.timeout() signal:
await fetch(url, {
signal: AbortSignal.timeout(10 * 1000),
});
But this is just a standalone signal, not a ...