Nonblocing getchar() or using printf() and serial.read() together

I want to keep the ability to use a simple printf() for writing messages on stdio (serial), and use the terminal program also to send inputs to a main loop. The getchar() function can read, but it is a blocking function. Is there a simple way to read non-blocking from the stdin?
I have tried to add

static BufferedSerial serial(NC, STDIO_UART_RX);

But the result is a blocking printf, it is stuck in wait_writable.
Is there a way to read non-blocking or check if a char is available?

got it, I have to use:

static BufferedSerial console(STDIO_UART_TX, STDIO_UART_RX, 115200);
FileHandle *mbed::mbed_override_console(int) {
      return &console;
 }

then printf works and I can use console.readable() and console.read().