github.com/status-im/status-go@v1.1.0/signal/signals.c (about)

     1  // ======================================================================================
     2  // cgo compilation (for desktop platforms and local tests)
     3  // ======================================================================================
     4  
     5  #include <stdio.h>
     6  #include <stddef.h>
     7  #include <stdbool.h>
     8  #include "_cgo_export.h"
     9  
    10  typedef void (*callback)(const char *jsonEvent);
    11  callback gCallback = 0;
    12  
    13  bool StatusServiceSignalEvent(const char *jsonEvent) {
    14  	if (gCallback) {
    15  		gCallback(jsonEvent);
    16  	} else {
    17  		NotifyNode((char *)jsonEvent); // re-send notification back to status node
    18  	}
    19  
    20  	return true;
    21  }
    22  
    23  void SetEventCallback(void *cb) {
    24  	gCallback = (callback)cb;
    25  }