Use fsleep instead of nanosleep
This commit is contained in:
parent
fb9c26ccd5
commit
8689ed5b27
|
@ -301,8 +301,7 @@ int main(void)
|
|||
}
|
||||
|
||||
if(n_rf_samples == 0) {
|
||||
struct timespec ts_1ms = {0, 1000000};
|
||||
nanosleep(&ts_1ms, NULL);
|
||||
fsleep(1e-3);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
#include <complex.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "sdr.h"
|
||||
|
||||
|
@ -141,10 +141,9 @@ static result_t stop_streaming(sdr_ctx_t *ctx)
|
|||
return OK;
|
||||
}
|
||||
|
||||
struct timespec ts_1ms = {0, 1000000};
|
||||
while(hackrf_is_streaming(ctx->hackrf) == HACKRF_TRUE) {
|
||||
puts("wr");
|
||||
nanosleep(&ts_1ms, NULL);
|
||||
fsleep(1e-3);
|
||||
}
|
||||
|
||||
ctx->status = SDR_STATUS_IDLE;
|
||||
|
@ -342,9 +341,9 @@ result_t sdr_receive(sdr_ctx_t *ctx, float complex *samples, size_t *nsamples, l
|
|||
|
||||
result_t sdr_flush_tx_buffer(sdr_ctx_t *ctx)
|
||||
{
|
||||
while(!ctx->tx_done) {
|
||||
struct timespec ts_1ms = {0, 1000000};
|
||||
nanosleep(&ts_1ms, NULL);
|
||||
// block until all samples have been transmitted
|
||||
while(!ctx->tx_done || (get_hires_time() < (ctx->tx_start_time + ctx->tx_duration))) {
|
||||
fsleep(1e-3);
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
|
Loading…
Reference in a new issue