MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / async_data_handler_stop

Function async_data_handler_stop

src/rig.c:8564–8601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8562
8563
8564static int async_data_handler_stop(RIG *rig)
8565{
8566 struct rig_state *rs = STATE(rig);
8567 async_data_handler_priv_data *async_data_handler_priv;
8568
8569 ENTERFUNC;
8570
8571 rs->async_data_handler_thread_run = 0;
8572
8573 async_data_handler_priv = (async_data_handler_priv_data *)
8574 rs->async_data_handler_priv_data;
8575
8576 if (async_data_handler_priv != NULL)
8577 {
8578 if (async_data_handler_priv->thread_id != 0)
8579 {
8580 // all cleanup is done in this function so we can kill thread
8581 // Windows was taking 30 seconds to stop without this
8582 pthread_cancel(async_data_handler_priv->thread_id);
8583 int err = pthread_join(async_data_handler_priv->thread_id, NULL);
8584
8585 if (err)
8586 {
8587 rig_debug(RIG_DEBUG_ERR, "%s: pthread_join error: %s\n", __func__,
8588 strerror(errno));
8589 // just ignore the error
8590 }
8591
8592 async_data_handler_priv->thread_id = 0;
8593 }
8594
8595 free(rs->async_data_handler_priv_data);
8596 rs->async_data_handler_priv_data = NULL;
8597 }
8598
8599
8600 RETURNFUNC(RIG_OK);
8601}
8602
8603static int morse_data_handler_stop(RIG *rig)
8604{

Callers 1

rig_closeFunction · 0.85

Calls 3

pthread_cancelFunction · 0.85
pthread_joinFunction · 0.85
rig_debugFunction · 0.85

Tested by

no test coverage detected