create hash codes for place shared objects

This commit is contained in:
Kevin Tew 2011-07-15 11:42:40 -06:00
parent ce32003de2
commit bf4a8ad5c4
2 changed files with 31 additions and 3 deletions

View File

@ -166,6 +166,30 @@
(place-wait p))))
(define (main)
(let ()
(define flx (make-shared-fxvector 10 0))
(define flv (make-shared-flvector 10 0.0))
(define bs (make-shared-bytes 10 60))
(define-values (in out) (place-channel))
(define p (place ch
(define a
(for/hash ([x (place-channel-get ch)])
(values x x)))
(define b
(for/hash ([x (place-channel-get ch)])
(values x x)))
(test #t eq? a a)
(test #t eq? b b)
(test #f eq? a b)
(test #t equal? a b)
(test #t equal? b a)))
(place-channel-put p (list flx flv bs in out))
(place-channel-put p (list flx flv bs in out))
(place-wait p))
(let ()
(define p1 (place ch
(define in (place-channel-get ch))
@ -228,7 +252,6 @@
(test (void) printf "signal-handle vector growing completes"))
(let ([pl (place-worker)])
(define flv1 (shared-flvector 0.0 1.0 2.0 3.0))
(define flv2 (make-shared-flvector 4 3.0))

View File

@ -844,16 +844,21 @@ static Scheme_Object *trivial_copy(Scheme_Object *so)
case scheme_false_type:
case scheme_null_type:
case scheme_void_type:
case scheme_place_bi_channel_type: /* allocated in the master and can be passed along as is */
return so;
case scheme_place_type:
scheme_hash_key(((Scheme_Place *) so)->channel);
return ((Scheme_Place *) so)->channel;
break;
case scheme_place_bi_channel_type: /* allocated in the master and can be passed along as is */
scheme_hash_key(so);
return so;
case scheme_byte_string_type:
case scheme_flvector_type:
case scheme_fxvector_type:
if (SHARED_ALLOCATEDP(so))
if (SHARED_ALLOCATEDP(so)) {
scheme_hash_key(so);
return so;
}
}
return NULL;