~audio-recorder/audio-recorder/trunk

« back to all changes in this revision

Viewing changes to src/rec-manager.c

  • Committer: Osmo Antero
  • Date: 2012-04-01 17:50:18 UTC
  • Revision ID: osmoma@gmail.com-20120401175018-8s296s7i5b6xnjwe
Version 0.8 with some clean ups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
403
403
}
404
404
 
405
405
void *rec_manager_command_thread(gpointer user_data) {
406
 
    #define TIMEOUT_USECONDS (5*G_USEC_PER_SEC)
 
406
#define TIMEOUT_USECONDS (5*G_USEC_PER_SEC)
407
407
 
408
408
    while (!g_rec_manager_stop) {
409
409
 
412
412
        // Glib version is < 2.31.20?
413
413
        // Ref: http://developer.gnome.org/glib/2.30/glib-Version-Information.html
414
414
        //      http://ftp.gnome.org/pub/gnome/sources/glib/
415
 
        // 
416
 
        // $ pkg-config --modversion glib-2.0 
417
 
        // 
418
 
        #if (!GLIB_CHECK_VERSION(2, 31, 18))
419
 
            // Glib version is < 2.31.18.
420
 
            // We must use the older g_async_queue_timed_pop(...) function.
421
 
 
422
 
            // Get current time
423
 
            GTimeVal time;
424
 
            g_get_current_time(&time);
425
 
            g_time_val_add(&time, TIMEOUT_USECONDS/*in micro seconds*/);
426
 
 
427
 
            // Read next command from the queue
428
 
            cmd = (RecorderCommand*)g_async_queue_timed_pop(g_cmd_queue, &time);
429
 
        #else
430
 
            // Glib version is >= 2.31.18.
431
 
            // We use the newer g_async_queue_timeout_pop(...) function.
432
 
 
433
 
            // Read next command from the queue
434
 
            cmd = (RecorderCommand*)g_async_queue_timeout_pop(g_cmd_queue, TIMEOUT_USECONDS/*in micro seconds*/);
435
 
        #endif
 
415
        //
 
416
        // $ pkg-config --modversion glib-2.0
 
417
        //
 
418
#if (!GLIB_CHECK_VERSION(2, 31, 18))
 
419
        // Glib version is < 2.31.18.
 
420
        // We must use the older g_async_queue_timed_pop(...) function.
 
421
 
 
422
        // Get current time
 
423
        GTimeVal time;
 
424
        g_get_current_time(&time);
 
425
        g_time_val_add(&time, TIMEOUT_USECONDS/*in micro seconds*/);
 
426
 
 
427
        // Read next command from the queue
 
428
        cmd = (RecorderCommand*)g_async_queue_timed_pop(g_cmd_queue, &time);
 
429
#else
 
430
        // Glib version is >= 2.31.18.
 
431
        // We use the newer g_async_queue_timeout_pop(...) function.
 
432
 
 
433
        // Read next command from the queue
 
434
        cmd = (RecorderCommand*)g_async_queue_timeout_pop(g_cmd_queue, TIMEOUT_USECONDS/*in micro seconds*/);
 
435
#endif
436
436
 
437
437
        if (!cmd) continue;
438
438