summaryrefslogtreecommitdiffstats
path: root/test/test-partial.c
blob: 62b91ad9bf2c6df889e54744493bd2cf97dac17a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "kiro-trb.h"
#include "kiro-sb.h"


int count = 0;


KiroContinueFlag
callback (KiroSb *sb) {
    (void)sb;
    g_message ("Got new element");
    count++;
    return KIRO_CALLBACK_CONTINUE;
}

int 
main ( int argc, char *argv[] )
{
    if (argc < 3) {
        printf ("Not enough aruments. Usage: kiro-test-bandwidth <address> <port>\n");
        return -1;
    }


    KiroSb *ksb = kiro_sb_new ();
    kiro_sb_clone (ksb, argv[1], argv[2]);
    unsigned long int callback_id = kiro_sb_add_sync_callback (ksb, (KiroSbSyncCallbackFunc)callback, ksb);

    while (count < 3) {}
    kiro_sb_remove_sync_callback (ksb, callback_id);

    while (count < 6) {
        kiro_sb_get_data_blocking (ksb);
        g_message ("Got new element");
        count++;
    }

    kiro_sb_free (ksb);

    return 0;
}