[gforth] / gforth / unix / pthread.fs  

gforth: gforth/unix/pthread.fs

Diff for /gforth/unix/pthread.fs between version 1.23 and 1.24

version 1.23, Sat Mar 24 22:52:49 2012 UTC version 1.24, Tue Apr 3 22:12:51 2012 UTC
Line 190 
Line 190 
     \c   pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);      \c   pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
     \c   return &attr;      \c   return &attr;
     \c }      \c }
       \c void create_pipe(FILE ** addr)
       \c {
       \c   int epipe[2];
       \c   pipe(epipe);
       \c   addr[0]=fdopen(epipe[0], "r");
       \c   addr[1]=fdopen(epipe[1], "a");
       \c   setvbuf(addr[1], NULL, _IONBF, 0);
       \c }
     c-function pthread+ pthread_plus a -- a ( addr -- addr' )      c-function pthread+ pthread_plus a -- a ( addr -- addr' )
     c-function pthreads pthreads n -- n ( n -- n' )      c-function pthreads pthreads n -- n ( n -- n' )
     c-function thread_start gforth_thread_p -- a ( -- addr )      c-function thread_start gforth_thread_p -- a ( -- addr )
Line 203 
Line 211 
     c-function pthread-mutexes pthread_mutexes n -- n ( n -- n' )      c-function pthread-mutexes pthread_mutexes n -- n ( n -- n' )
     c-function pause sched_yield -- void ( -- )      c-function pause sched_yield -- void ( -- )
     c-function pthread_detatch_attr pthread_detach_attr -- a ( -- addr )      c-function pthread_detatch_attr pthread_detach_attr -- a ( -- addr )
       c-function create_pipe create_pipe a -- void ( pipefd[2] -- )
 end-c-library  end-c-library
   
 User pthread-id  -1 cells pthread+ uallot drop  User pthread-id  -1 cells pthread+ uallot drop
   User epiper
   User epipew
   
 :noname    ' >body @ ;  :noname    ' >body @ ;
 :noname    ' >body @ postpone literal ;  :noname    ' >body @ postpone literal ;
Line 215 
Line 226 
 : >task ( user task -- user' )  + next-task - ;  : >task ( user task -- user' )  + next-task - ;
   
 : kill-task ( -- )  : kill-task ( -- )
     0 (bye) ;      epiper @ close-file drop   epipew @ close-file drop  0 (bye) ;
   
 :noname ( -- )  :noname ( -- )
     [ here throw-entry ! ]      [ here throw-entry ! ]
Line 230 
Line 241 
     throw-entry r@ udp @ throw-entry next-task - /string move      throw-entry r@ udp @ throw-entry next-task - /string move
     word-pno-size chars dup allocate throw dup holdbufptr r@ >task !      word-pno-size chars dup allocate throw dup holdbufptr r@ >task !
     + dup holdptr r@ >task !  holdend r@ >task !      + dup holdptr r@ >task !  holdend r@ >task !
       epiper r@ >task create_pipe
     ['] kill-task >body  rp0 r@ >task @ 1 cells - dup rp0 r@ >task ! !      ['] kill-task >body  rp0 r@ >task @ 1 cells - dup rp0 r@ >task ! !
     handler r@ >task off      handler r@ >task off
     r> ;      r> ;


Generate output suitable for use with a patch program
Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help