Paul,
I am a system designer, not a coder. I have done what I think is correct to get the code in owlib to compile without pthreads. I neither claim correctness nor beauty for the patches. Please review them and make the right changes as needed.
jerry
Jerry Scharf laguna way consulting
patch file:
*** ow_dir.c.dist 2005-04-15 18:10:46.000000000 -0700
--- ow_dir.c 2005-05-01 08:38:18.463038206 -0700
***************
*** 297,305 ****
/* FS_dir_seek produces the data that can vary: device lists, etc. */
static int FS_dir_seek( void (* dirfunc)(const struct parsedname * const), const struct parsedname * const pn, uint32_t * flags ) {
int ret = 0 ;
#ifdef OW_MT
pthread_t thread ;
- struct parsedname pncopy ;
int threadbad = 1;
void * v ;
int rt ;
--- 297,305 ----
/* FS_dir_seek produces the data that can vary: device lists, etc. */
static int FS_dir_seek( void (* dirfunc)(const struct parsedname * const), const struct parsedname * const pn, uint32_t * flags ) {
int ret = 0 ;
+ struct parsedname pncopy ;
#ifdef OW_MT
pthread_t thread ;
int threadbad = 1;
void * v ;
int rt ;
*** ow_net.c.dist 2005-04-18 06:57:52.000000000 -0700
--- ow_net.c 2005-05-01 09:08:22.572022105 -0700
***************
*** 150,155 ****
--- 150,156 ----
* the in-device and loop through the list until it works.
* Not a perfect solution, but it should work at least.
*/
+ #ifdef OW_MT
pthread_mutex_lock( &(in->bus_mutex) ) ;
ai = in->ai_ok ;
if( ai ) {
***************
*** 186,192 ****
} while ( (ai = ai->ai_next) ) ;
in->ai_ok = NULL ;
pthread_mutex_unlock( &(in->bus_mutex) ) ;
!
fprintf(stderr,"ClientConnect: Socket problem [%s]\n", strerror(errno)) ;
return -1 ;
}
--- 187,211 ----
} while ( (ai = ai->ai_next) ) ;
in->ai_ok = NULL ;
pthread_mutex_unlock( &(in->bus_mutex) ) ;
!
! #else /* OW_MT */
!
! ai = in->ai_ok ;
! if( ai ) {
! fd = socket(
! ai->ai_family,
! ai->ai_socktype,
! ai->ai_protocol
! ) ;
! if ( fd >= 0 ) {
! if ( connect(fd, ai->ai_addr, ai->ai_addrlen) == 0 ) {
! return fd ;
! }
! close( fd ) ;
! }
! }
! #endif /* OW_MT */
!
fprintf(stderr,"ClientConnect: Socket problem [%s]\n", strerror(errno)) ;
return -1 ;
}
***************
*** 208,219 ****
//#define VALGRIND 1
void ServerProcess( void (*HandlerRoutine)(int fd), void (*Exit)(int errcode) ) {
struct connection_out * out = outdevice ;
- struct connection_out * out_last = NULL;
#ifdef OW_MT
pthread_t thread ;
#ifndef __UCLIBC__
pthread_attr_t attr ;
#endif
/* embedded function */
void ToListen( struct connection_out * o ) {
--- 227,239 ----
//#define VALGRIND 1
void ServerProcess( void (*HandlerRoutine)(int fd), void (*Exit)(int errcode) ) {
struct connection_out * out = outdevice ;
#ifdef OW_MT
+ struct connection_out * out_last = NULL;
pthread_t thread ;
#ifndef __UCLIBC__
pthread_attr_t attr ;
#endif
+ #endif /* OW_MT */
/* embedded function */
void ToListen( struct connection_out * o ) {
***************
*** 231,236 ****
--- 251,258 ----
}
}+ #ifdef OW_MT
+
/* Embedded function */
void * ConnectionThread( void * v3 ) {
struct connection_out * out2 = (struct connection_out *)v3 ;
*** ow_read.c.dist 2005-04-15 18:10:46.000000000 -0700
--- ow_read.c 2005-05-01 08:35:55.760332262 -0700
***************
*** 197,209 ****
/* Loop through input devices (busses) */
static int FS_read_seek(char *buf, const size_t size, const off_t offset, const struct parsedname * pn ) {
int r = 0;
#ifdef OW_MT
pthread_t thread ;
int threadbad = 1;
char *buf2 ;
void * v ;
int rt ;
- size_t s ;
/* Embedded function */
void * Read2( void * vp ) {
--- 197,209 ----
/* Loop through input devices (busses) */
static int FS_read_seek(char *buf, const size_t size, const off_t offset, const struct parsedname * pn ) {
int r = 0;
+ size_t s ;
#ifdef OW_MT
pthread_t thread ;
int threadbad = 1;
char *buf2 ;
void * v ;
int rt ;
/* Embedded function */
void * Read2( void * vp ) {
*** ow_size.c.dist 2005-04-15 18:10:46.000000000 -0700
--- ow_size.c 2005-05-01 08:39:07.696381634 -0700
***************
*** 128,136 ****
/* FS_size_seek produces the data that can vary: device lists, etc. */
static int FS_size_seek( const struct parsedname * const pn ) {
int ret = 0 ;
#ifdef OW_MT
pthread_t thread ;
- struct parsedname pncopy ;
int threadbad = 1;
void * v ;
int rt ;
--- 128,136 ----
/* FS_size_seek produces the data that can vary: device lists, etc. */
static int FS_size_seek( const struct parsedname * const pn ) {
int ret = 0 ;
+ struct parsedname pncopy ;
#ifdef OW_MT
pthread_t thread ;
int threadbad = 1;
void * v ;
int rt ;
s
------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ Owfs-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/owfs-developers
