Return from sub-routine only if signal_connect

I’ve been trying to work this out for a while. Basically how do I get a callback to only return if a button or other widget does a signal in the called sub

sub do_something {
do stuff with a value;
return value to original subroutine

I cant work out how to only return if the do_something button is clicked

You cannot do something like this.

Signals are just fancy ways to invoke a list of functions using a well-known name; they are synchronous to their emission, but the emission can happen at any time—especially signals like GtkButton::clicked, which is the result of a complex series of windowing system events.