mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Cleanup
This commit is contained in:
parent
0bd2f85470
commit
3d03684f1f
1 changed files with 30 additions and 21 deletions
|
@ -4,11 +4,40 @@
|
|||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* This variable corresponds to the Scheme function (in the generated C file)
|
||||
* This variable corresponds to the Scheme function in the generated C file
|
||||
* that we wish to call into.
|
||||
*/
|
||||
extern object __glo_signal_91done;
|
||||
|
||||
/**
|
||||
* Code for the C thread.
|
||||
*
|
||||
* In our application we just call the trampoline function to setup a call
|
||||
* into Scheme code. In a real application this thread would probably do
|
||||
* quite a bit more work in C, only calling into Scheme code as necessary.
|
||||
*/
|
||||
void *c_thread(void *arg)
|
||||
{
|
||||
printf("Hello from C thread\n");
|
||||
sleep(1);
|
||||
printf("C calling into SCM\n");
|
||||
|
||||
object obj = c_trampoline(arg, __glo_signal_91done, boolean_t);
|
||||
|
||||
printf("C received: ");
|
||||
Cyc_write(NULL, obj, stdout);
|
||||
printf("\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Should not need to customize below here:
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Scheme function calls into this function when it is done.
|
||||
* We store results and longjmp back to where we started, at the
|
||||
|
@ -96,26 +125,6 @@ object c_trampoline(gc_thread_data *parent_thd, object fnc, object arg)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* C thread. In our application we just call the trampoline function
|
||||
* to setup a call into Scheme code. In a real application this thread
|
||||
* could do quite a bit more work in C, occasionally calling into
|
||||
* Scheme code as necessary.
|
||||
*/
|
||||
void *c_thread(void *arg)
|
||||
{
|
||||
printf("Hello from C thread\n");
|
||||
sleep(1);
|
||||
printf("C calling into SCM\n");
|
||||
|
||||
object obj = c_trampoline(arg, __glo_signal_91done, boolean_t);
|
||||
|
||||
printf("C received: ");
|
||||
Cyc_write(NULL, obj, stdout);
|
||||
printf("\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by Scheme to create the C thread.
|
||||
* This is required by sample app since we start
|
||||
|
|
Loading…
Add table
Reference in a new issue