K x = knk(5, ks((S)"AAPL"), kf(100.0), kf(100.0), ki(100), ki(100));
K ret = k(0, (S)".u.upd", ks((S)"quote"), x, (K)NULL);
if(!ret) printf("Socket broken\n");
if(ret->t==-128) printf("Error: %s\n", ret->s);
void *event_loop(void *args)
// this would select() from socket
extern "C" K listen(K ignore)
int rc = pthread_create(&thread, NULL, event_loop, NULL);
krr((S)"Unable to create thread");
This seems to work alight, but if I subscribe with another client, e.g. q cx.q show I get error message Error: no socket.
Noted that the Bloomberg feed handler utilizes fdevent.h, but since my program should run on OS X as well, this is not an option.
What is the proper way to handle this? I have tried looking at the Reuters feed handler, which uses pthread.h, but I haven't managed to implement it properly.
Tel: +44 (0)28 3025 2242
Tel: +1 (212) 447 6700
Tel: +61 (0)2 9236 5700