stream_pool_fraction.h 1.64 KB
#ifndef SCOT_STREAM_POOL_FRACTION_H
#define SCOT_STREAM_POOL_FRACTION_H

#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>

#include <scot/stream_pool.h>
#include <scot/event_listener.h>
#include <scot/scot_int.h>
#include <scot/stream.h>
#include <scot/thread.h>

#define SCOT_MAX_FRACTION		64 /* Windows kann max. 64 Objekte pro thread
												überwachen. */
												
struct scot_sp_fraction
{
	struct scot_event_listener * el;

	int                    stream_type; /* what streams to accept */

	THREAD_T               thread_handle;
	THREAD_ID_T            thread_id;
	int                    thread_run_flg;

	scot_thread_entry_fptr spf_entry_func; 

	uint16_t               s_count;
	struct scot_stream *   s_list [SCOT_MAX_FRACTION]; 
	int                    free_s;

	/* for select */
	fd_set rfds, wfds, efds;
	int max_fd;
};

extern scot_thread_entry_fptr scot_spf_thread_func[];

struct scot_sp_fraction * scot_spf_new      (struct scot_sp_fraction *,
                                             struct scot_event_listener *,
                                             int);
void                      scot_spf_free     (struct scot_sp_fraction *);
void                      scot_spf_free_s   (struct scot_sp_fraction *,
                                             int);
void                      scot_spf_add      (struct scot_sp_fraction *, 
                                             struct scot_stream *,
														   int);
void                      scot_spf_remove   (struct scot_sp_fraction *,
                                             struct scot_stream *,
														   int);

#endif /* SCOT_STREAM_POOL_FRACTION_H */