rllib  1
Classes | Macros | Functions
rldataprovider.cpp File Reference
#include "rldataprovider.h"
#include <stdio.h>
#include <string.h>
Include dependency graph for rldataprovider.cpp:

Go to the source code of this file.

Classes

struct  WORKER_DATA
 

Macros

#define CLIENT_TIMEOUT   1000
 

Functions

static void * workerThread (void *arg)
 
static void * rlDataProviderAccept (void *arg)
 

Macro Definition Documentation

◆ CLIENT_TIMEOUT

#define CLIENT_TIMEOUT   1000

Definition at line 333 of file rldataprovider.cpp.

Function Documentation

◆ rlDataProviderAccept()

static void* rlDataProviderAccept ( void *  arg)
static

Definition at line 593 of file rldataprovider.cpp.

594 {
595  int s;
596  rlThread worker;
597  WORKER_DATA worker_data;
598  rlDataProviderThreads *provider_threads;
599  THREAD_PARAM *p = (THREAD_PARAM *) arg;
600  if(arg == NULL) return NULL;
601  provider_threads = (rlDataProviderThreads *) p->user;
602  if(provider_threads == NULL) return NULL;
603  rlSocket socket("localhost",provider_threads->port,0);
604 
605  while(1)
606  {
607  s = socket.connect();
608  if(s == -1) break;
609  worker_data.thread = provider_threads;
610  worker_data.socket = s;
611  worker.create(workerThread,&worker_data);
612  rlsleep(100);
613  }
614  return NULL;
615 }
void * user
Definition: rlthread.h:30
int create(void *(*func)(void *), void *argument)
Definition: rlthread.cpp:35
void rlsleep(long msec)
Definition: rlwthread.cpp:396
static void * workerThread(void *arg)
rlDataProviderThreads * thread

◆ workerThread()

static void* workerThread ( void *  arg)
static

Definition at line 580 of file rldataprovider.cpp.

581 {
582  WORKER_DATA *worker_data;
583  THREAD_PARAM *p = (THREAD_PARAM *) arg;
584  if(arg == NULL) return NULL;
585  worker_data = (WORKER_DATA *) p->user;
586  rlSocket socket(worker_data->socket);
587 
588  worker_data->thread->provider->run(&socket);
589 
590  return NULL;
591 }
void * user
Definition: rlthread.h:30
int run(rlSocket *socket)
rlDataProvider * provider
rlDataProviderThreads * thread