阅读代码增加的注释

This commit is contained in:
jiskra 2017-06-10 13:30:45 +08:00
parent a474281377
commit 0e673c44e6

View File

@ -340,6 +340,7 @@ void modesInitRTLSDR(void) {
device_count = rtlsdr_get_device_count(); device_count = rtlsdr_get_device_count();
if (!device_count) { if (!device_count) {
}
fprintf(stderr, "No supported RTLSDR devices found.\n"); fprintf(stderr, "No supported RTLSDR devices found.\n");
exit(1); exit(1);
} }
@ -399,10 +400,10 @@ void rtlsdrCallback(unsigned char *buf, uint32_t len, void *ctx) {
* on the start of the new buffer. */ * on the start of the new buffer. */
memcpy(Modes.data, Modes.data+MODES_DATA_LEN, (MODES_FULL_LEN-1)*4); memcpy(Modes.data, Modes.data+MODES_DATA_LEN, (MODES_FULL_LEN-1)*4);
/* Read the new data. */ /* Read the new data. */
memcpy(Modes.data+(MODES_FULL_LEN-1)*4, buf, len); memcpy(Modes.data+(MODES_FULL_LEN-1)*4, buf, len);//memcpy*dest*src,LEN
Modes.data_ready = 1; Modes.data_ready = 1;
/* Signal to the other thread that new data is ready */ /* Signal to the other thread that new data is ready */
pthread_cond_signal(&Modes.data_cond); pthread_cond_signal(&Modes.data_cond); //pthread_cond_signal函数的作用是发送一个信号给另外一个处于阻塞状态的线程使其脱离阻塞状态继续执行。
pthread_mutex_unlock(&Modes.data_mutex); pthread_mutex_unlock(&Modes.data_mutex);
} }