Skip to content

Commit

Permalink
Merge pull request OpenSmalltalk#277 from syrel/issue-273-callback-co…
Browse files Browse the repository at this point in the history
…mpile-error

[pharo-project/pharo-vm#273] fix callback.c compilation error on windows
  • Loading branch information
guillep committed Jun 21, 2021
2 parents dec86f4 + 76692c9 commit 8d09dc3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ffi/include/pThreadedFFI.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include <stdio.h>
#include <ffi.h>
#if FEATURE_THREADED_FFI
#include <pthread.h>
#ifdef _WIN32
# include <Windows.h>
#else
# include <pthread.h>
#endif
#endif
#include <errno.h>
#include <stdlib.h>
Expand Down
12 changes: 11 additions & 1 deletion ffiTestLibrary/src/callbacks.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "callbacks.h"
#if FEATURE_THREADED_FFI
#include <pthread.h>
#ifdef _WIN32
# include <Windows.h>
#else
# include <pthread.h>
#endif
#endif //FEATURE_THREADED_FFI

EXPORT(int) singleCallToCallback(SIMPLE_CALLBACK fun, int base){
Expand Down Expand Up @@ -32,7 +36,13 @@ static int value = 0;
#if FEATURE_THREADED_FFI
void* otherThread(void* aFunction){
SIMPLE_CALLBACK f = (SIMPLE_CALLBACK) aFunction;

#ifdef _WIN32
Sleep(3);
#else
sleep(3);
#endif

value = f(42);
}
#endif //FEATURE_THREADED_FFI
Expand Down

0 comments on commit 8d09dc3

Please sign in to comment.