mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-03 19:26:34 +02:00
Added comments
This commit is contained in:
parent
cc630028f9
commit
40bcf2d5dc
2 changed files with 10 additions and 0 deletions
|
@ -2866,6 +2866,8 @@ object Cyc_thread_sleep(void *data, object timeout)
|
||||||
return boolean_t;
|
return boolean_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy given object to the heap, if it is from the stack.
|
||||||
|
// This function is intended to be called directly from application code
|
||||||
object copy2heap(void *data, object obj)
|
object copy2heap(void *data, object obj)
|
||||||
{
|
{
|
||||||
char stack_pos;
|
char stack_pos;
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
thread-yield!
|
thread-yield!
|
||||||
; thread-terminate!
|
; thread-terminate!
|
||||||
; For now, these are built-ins. No need for them here: make-mutex mutex-lock! mutex-unlock!
|
; For now, these are built-ins. No need for them here: make-mutex mutex-lock! mutex-unlock!
|
||||||
|
;; TODO: consolidate built-ins, and convert them from primitives to FFI functions
|
||||||
|
;; in this module.
|
||||||
|
;; Non-standard functions:
|
||||||
->heap
|
->heap
|
||||||
)
|
)
|
||||||
(begin
|
(begin
|
||||||
|
@ -46,6 +49,11 @@
|
||||||
(define (thread-yield!) (thread-sleep! 1))
|
(define (thread-yield!) (thread-sleep! 1))
|
||||||
; (define (thread-terminate!) (Cyc-end-thread!))
|
; (define (thread-terminate!) (Cyc-end-thread!))
|
||||||
;; TODO: thread-join!
|
;; TODO: thread-join!
|
||||||
|
|
||||||
|
;; Take a single object and if it is on the stack, return a copy
|
||||||
|
;; of it that is allocated on the heap. NOTE the original object
|
||||||
|
;; will still live on the stack, and will eventually be moved
|
||||||
|
;; itself to the heap if it is referenced during minor GC.
|
||||||
(define-c ->heap
|
(define-c ->heap
|
||||||
"(void *data, int argc, closure _, object k, object obj)"
|
"(void *data, int argc, closure _, object k, object obj)"
|
||||||
" object heap_obj = copy2heap(data, obj);
|
" object heap_obj = copy2heap(data, obj);
|
||||||
|
|
Loading…
Add table
Reference in a new issue