mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-06 12:46:35 +02:00
Initial file
This commit is contained in:
parent
c18ca25ad9
commit
2ca6aa4910
2 changed files with 37 additions and 0 deletions
28
ck-polyfill.c
Normal file
28
ck-polyfill.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Cyclone Scheme
|
||||
* https://github.com/justinethier/cyclone
|
||||
*
|
||||
* Copyright (c) 2020, Justin Ethier
|
||||
* All rights reserved.
|
||||
*
|
||||
* FFI module to support calling Scheme code from C.
|
||||
*/
|
||||
|
||||
#include "cyclone/types.h"
|
||||
#include "cyclone/runtime.h"
|
||||
#include <ck_pr.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// TODO: global pthread mutex lock for this? obviously not ideal but the
|
||||
// whole purpose of this module is a minimal interface for compatibility
|
||||
// not speed
|
||||
|
||||
bool
|
||||
ck_pr_cas_int(int *target, int old_value, int new_value)
|
||||
{
|
||||
if (*target == old_value) {
|
||||
*target = new_value;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
9
ck_pr.h
Normal file
9
ck_pr.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef CYCLONE_CK_POLYFILL_H
|
||||
#define CYCLONE_CK_POLYFILL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
bool
|
||||
ck_pr_cas_int(int *target, int old_value, int new_value);
|
||||
|
||||
#endif /* CYCLONE_CK_POLYFILL_H */
|
Loading…
Add table
Reference in a new issue