Ignore:
Timestamp:
02/04/09 01:48:45 (11 years ago)
Author:
Kon Lovett
Message:

defaults.make : chking of svnrev sep from svnrev fil as a target
lolevel.scm : comment fix
runtime.c : use of C defines for platform info, reflow of some comments/code due to > 100 chars long, cl -> closure (like other procs), use of macros rather than open-coded block access, added return value testing for FreeLibrary? & shl_unlaod.
library.scm : refactored make-property-condition & condition-property-accessor so ##sy# routine available, make ##sys# routines for breakpoint condition, placed 'continuation, etc, on breakpoint condition & not exn.
chicken.h : use of C defines for platform info, added comments, C_CHAR_SHIFT.
posixunix.scm, posixwin.scm : added use of Unit ports
scheduler.scm : use of library breakpoint condition routines, placed 'continuation, etc, on breakpoint condition & not exn
srfi-18.scm : renamed some -inlines (match chicken-thread-object-inlines)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/branches/chicken-3/chicken-thread-object-inlines.scm

    r13143 r13178  
    22;;;; Kon Lovett, Jan '09
    33
    4 ;;;; Provides inlines & macros for thread objects
    5 ;;;; MUST be included
    6 ;;;; NEEDS "chicken-primitive-inlines" included
     4; Usage
     5;
     6; (include "chicken-primitive-object-inlines")
     7; (include "chicken-thread-object-inlines")
     8
     9;; Notes
     10;
     11; Provides inlines & macros for thread objects. Use of these procedures
     12; by non-core & non-core-extensions is highly suspect. Many of these routines
     13; are unsafe.
     14;
     15; In fact, any use is suspect ;-)
     16
    717
    818;;; Mutex object helpers:
     
    1929
    2030(define-inline (%mutex? x)
    21   (%structure-instance? x 'mutex) )
     31  (%structure? x 'mutex) )
    2232
    2333(define-inline (%mutex-name mx)
     
    2838
    2939(define-inline (%mutex-thread-set! mx th)
    30   (%structure-slot-set! mx 2 th) )
     40  (%structure-set! mx 2 th) )
    3141
    3242(define-inline (%mutex-thread-clear! mx)
    33   (%structure-immediate-set! mx 2 #f) )
     43  (%structure-set!/immediate mx 2 #f) )
    3444
    3545(define-inline (%mutex-waiters mx)
     
    3747
    3848(define-inline (%mutex-waiters-set! mx wt)
    39   (%structure-slot-set! mx 3 wt) )
     49  (%structure-set! mx 3 wt) )
     50
     51(define-inline (%mutex-waiters-empty? mx)
     52  (%null? (%mutex-waiters mx)) )
     53
     54(define-inline (%mutex-waiters-empty! mx)
     55  (%structure-set!/immediate mx 3 '()) )
    4056
    4157(define-inline (%mutex-waiters-add! mx th)
     
    4359
    4460(define-inline (%mutex-waiters-delete! mx th)
    45   (%mutex-waiters-set! mx (##sys#delq th (%mutex-waiters mx))) )
    46 
    47 (define-inline (%mutex-waiters-empty? mx)
    48   (%null? (%mutex-waiters mx)) )
    49 
    50 (define-inline (%mutex-waiters-forget! mx)
    51   (%structure-immediate-set! mx 3 '()) )
     61  (%mutex-waiters-set! mx (%delq! th (%mutex-waiters mx))) )
    5262
    5363(define-inline (%mutex-waiters-pop! mx)
     
    6171
    6272(define-inline (%mutex-abandoned-set! mx f)
    63   (%structure-immediate-set! mx 4 f) )
     73  (%structure-set!/immediate mx 4 f) )
    6474
    6575(define-inline (%mutex-locked? mx)
     
    6777
    6878(define-inline (%mutex-locked-set! mx f)
    69   (%structure-immediate-set! mx 5 f) )
     79  (%structure-set!/immediate mx 5 f) )
    7080
    7181(define-inline (%mutex-specific mx)
     
    7383
    7484(define-inline (%mutex-specific-set! mx x)
    75   (%structure-slot-set! mx 6 x) )
     85  (%structure-set! mx 6 x) )
    7686
    7787
     
    102112
    103113(define-inline (%thread? x)
    104   (%structure-instance? x 'thread) )
     114  (%structure? x 'thread) )
    105115
    106116(define-inline (%thread-thunk th)
     
    108118
    109119(define-inline (%thread-thunk-set! th tk)
    110   (%structure-slot-set! th 1 tk) )
     120  (%structure-set! th 1 tk) )
    111121
    112122(define-inline (%thread-results th)
     
    114124
    115125(define-inline (%thread-results-set! th rs)
    116   (%structure-slot-set! th 2 rs) )
     126  (%structure-set! th 2 rs) )
    117127
    118128(define-inline (%thread-state th)
     
    120130
    121131(define-inline (%thread-state-set! th st)
    122   (%structure-slot-set! th 3 st) )
     132  (%structure-set! th 3 st) )
    123133
    124134(define-inline (%thread-block-timeout th)
     
    126136
    127137(define-inline (%thread-block-timeout-set! th to)
    128   (%structure-immediate-set! th 4 to) )
     138  (%structure-set!/immediate th 4 to) )
    129139
    130140(define-inline (%thread-block-timeout-clear! th)
     
    135145
    136146(define-inline (%thread-state-buffer-set! th v)
    137   (%structure-slot-set! th 5 v) )
     147  (%structure-set! th 5 v) )
    138148
    139149(define-inline (%thread-name th)
     
    144154
    145155(define-inline (%thread-reason-set! th cd)
    146   (%structure-slot-set! th 7 cd) )
     156  (%structure-set! th 7 cd) )
    147157
    148158(define-inline (%thread-mutexes th)
     
    150160
    151161(define-inline (%thread-mutexes-set! th wt)
    152   (%structure-slot-set! th 8 wx) )
     162  (%structure-set! th 8 wx) )
    153163
    154164(define-inline (%thread-mutexes-empty? th)
    155165  (%null? (%thread-mutexes th)) )
    156166
    157 (define-inline (%thread-mutexes-forget! th)
    158   (%structure-immediate-set! th 8 '()) )
     167(define-inline (%thread-mutexes-empty! th)
     168  (%structure-set!/immediate th 8 '()) )
    159169
    160170(define-inline (%thread-mutexes-add! th mx)
     
    162172
    163173(define-inline (%thread-mutexes-delete! th mx)
    164   (%thread-mutexes-set! th (##sys#delq mx (%thread-mutexes th))) )
     174  (%thread-mutexes-set! th (%delq! mx (%thread-mutexes th))) )
    165175
    166176(define-inline (%thread-quantum th)
     
    168178
    169179(define-inline (%thread-quantum-set! th qt)
    170   (%structure-immediate-set! th 9 qt) )
     180  (%structure-set!/immediate th 9 qt) )
    171181
    172182(define-inline (%thread-specific th)
     
    174184
    175185(define-inline (%thread-specific-set! th x)
    176   (%structure-slot-set! th 10 x) )
     186  (%structure-set! th 10 x) )
    177187
    178188(define-inline (%thread-block-object th)
     
    180190
    181191(define-inline (%thread-block-object-set! th x)
    182   (%structure-slot-set! th 11 x) )
     192  (%structure-set! th 11 x) )
    183193
    184194(define-inline (%thread-block-object-clear! th)
    185   (%structure-immediate-set! th 11 #f) )
     195  (%structure-set!/immediate th 11 #f) )
    186196
    187197(define-inline (%thread-recipients th)
     
    189199
    190200(define-inline (%thread-recipients-set! th x)
    191   (%structure-slot-set! th 12 x) )
     201  (%structure-set! th 12 x) )
     202
     203(define-inline (%thread-recipients-empty? th)
     204  (%null? (%condition-variable-waiters th)) )
     205
     206(define-inline (%thread-recipients-empty! th)
     207  (%structure-set!/immediate th 12 '()) )
    192208
    193209(define-inline (%thread-recipients-add! th rth)
    194210  (%thread-recipients-set! t (%cons rth (%thread-recipients t))) )
    195 
    196 (define-inline (%thread-recipients-forget! th)
    197   (%structure-immediate-set! th 12 '()) )
    198211
    199212(define-inline (%thread-recipients-process! th tk)
    200213  (let ([rs (%thread-recipients t)])
    201214    (unless (%null? rs) (for-each tk rs) ) )
    202   (thread-recipients-forget! t) )
     215  (thread-recipients-empty! t) )
    203216
    204217(define-inline (%thread-unblocked-by-timeout? th)
     
    206219
    207220(define-inline (%thread-unblocked-by-timeout-set! th f)
    208   (%structure-immediate-set! th 13 f) )
     221  (%structure-set!/immediate th 13 f) )
    209222
    210223
     
    219232
    220233(define-inline (%condition-variable? x)
    221   (%structure-instance? x 'condition-variable) )
     234  (%structure? x 'condition-variable) )
    222235
    223236(define-inline (%condition-variable-name cv)
     
    228241
    229242(define-inline (%condition-variable-waiters-set! cv x)
    230   (%structure-slot-set! cv 2 x) )
     243  (%structure-set! cv 2 x) )
     244
     245(define-inline (%condition-variable-waiters-empty? cv)
     246  (%null? (%condition-variable-waiters cv)) )
     247
     248(define-inline (%condition-variable-waiters-empty! cv)
     249  (%structure-set!/immediate cv 2 '()) )
    231250
    232251(define-inline (%condition-variable-waiters-add! cv th)
     
    234253
    235254(define-inline (%condition-variable-waiters-delete! cv th)
    236   (%condition-variable-waiters-set! cv (##sys#delq th (%condition-variable-waiters cv))) )
    237 
    238 (define-inline (%condition-variable-waiters-empty? mx)
    239   (%null? (%condition-variable-waiters mx)) )
     255  (%condition-variable-waiters-set! cv (%delq! th (%condition-variable-waiters cv))) )
    240256
    241257(define-inline (%condition-variable-waiters-pop! mx)
     
    245261    top ) )
    246262
    247 (define-inline (%condition-variable-waiters-clear! cv)
    248   (%structure-immediate-set! cv 2 '()) )
    249 
    250263(define-inline (%condition-variable-specific cv)
    251264  (%structure-ref cv 3) )
    252265
    253266(define-inline (%condition-variable-specific-set! cv x)
    254   (%structure-slot-set! cv 3 x) )
     267  (%structure-set! cv 3 x) )
Note: See TracChangeset for help on using the changeset viewer.