File tree Expand file tree Collapse file tree 6 files changed +28
-6
lines changed Expand file tree Collapse file tree 6 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ GST_HAVE_GMP
27
27
28
28
_AM_DEPENDENCIES ( OBJC )
29
29
AC_CANONICAL_HOST
30
- LDFLAGS=-module
30
+ LDFLAGS=" -module -lpthread -no-undefined"
31
31
case $host in
32
32
*-*-darwin*) OBJCLIBS='-framework Cocoa' ;;
33
33
*) AC_CHECK_TOOL ( GNUSTEP_CONFIG , [ gnustep-config] ,
@@ -43,8 +43,7 @@ case $host in
43
43
*i386*) AC_DEFINE ( [ __i386__] ) ;;
44
44
*x86_64*) AC_DEFINE ( [ __x86_64__] ) ;;
45
45
esac
46
-
47
- LDFLAGS+=" -no-undefined"
46
+
48
47
AC_SUBST ( OBJC , [ $CC] )
49
48
AC_SUBST ( OBJCFLAGS , [ $CFLAGS] )
50
49
AC_SUBST ( GNUSTEP_CFLAGS )
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ typedef struct gst_objc_object
15
15
}
16
16
*gst_objc_object;
17
17
18
+ /* Initialize threading object */
19
+ void gst_initThreading ();
20
+
18
21
/* Initialize ffi type */
19
22
void gst_initFFIType ();
20
23
Original file line number Diff line number Diff line change 1
1
#include < ffi.h>
2
2
#import " gst-objc-ext.h"
3
3
4
- // extern VMProxy* gst_proxy;
4
+ pthread_mutex_t gstProxyMutex;
5
+
5
6
ffi_type *ffi_type_cgfloat;
6
7
ffi_type ffi_type_nspoint;
7
8
ffi_type ffi_type_nsrect;
20
21
}
21
22
objc_ffi_closure;
22
23
24
+ void gst_initThreading ()
25
+ {
26
+ pthread_mutex_init (&gstProxyMutex, NULL );
27
+ }
28
+
23
29
void gst_initFFIType ()
24
30
{
25
31
ffi_type_cgfloat = (sizeof (CGFloat) == sizeof (double )) ? &ffi_type_double : &ffi_type_float;
@@ -524,7 +530,9 @@ void gst_initFFIType ()
524
530
gst_boxValue (args[i+2 ], argsOOP+i, [sig getArgumentTypeAtIndex: i+2 ]);
525
531
}
526
532
argsOOP[i] = NULL ;
533
+ GST_LOCK_PROXY;
527
534
resultOOP = gst_proxy->vmsgSend (receiver, selector, argsOOP);
535
+ GST_UNLOCK_PROXY;
528
536
gst_unboxValue (resultOOP, result, [sig methodReturnType ]);
529
537
530
538
}
Original file line number Diff line number Diff line change 1
1
#include < gstpub.h>
2
+ #include < pthread.h>
2
3
#import " gst-objc-ext.h"
3
4
#import < Foundation/Foundation.h>
4
5
// #import "LKInterpreterRuntime.h"
5
6
#ifndef GNU_RUNTIME
6
7
#include < objc/objc-runtime.h>
7
8
#endif
8
9
10
+ /* Smallltalk proxy */
9
11
extern VMProxy* gst_proxy;
12
+
13
+ /* Mutex to prevent gst_proxy race access */
14
+ extern pthread_mutex_t gstProxyMutex;
15
+
16
+ #define GST_LOCK_PROXY (pthread_mutex_lock (&gstProxyMutex))
17
+ #define GST_UNLOCK_PROXY (pthread_mutex_unlock (&gstProxyMutex))
Original file line number Diff line number Diff line change 17
17
#endif // __APPLE__
18
18
19
19
gst_initFFIType ();
20
+ gst_initThreading ();
20
21
proxy->defineCFunc (" objc_sendMsg" , gst_sendMessage);
21
- proxy->defineCFunc (" objc_sizeofCGFloat" , gst_sizeofCGFloat);
22
+ proxy->defineCFunc (" objc_sizeofCGFloat" , gst_sizeofCGFloat);
22
23
proxy->defineCFunc (" objc_sendReturnSize" , gst_sendMessageReturnSize);
23
24
proxy->defineCFunc (" objc_sendReturnType" , gst_sendMessageReturnType);
24
25
proxy->defineCFunc (" objc_setIvarOOP" , gst_setIvarOOP);
Original file line number Diff line number Diff line change @@ -41,8 +41,11 @@ - (void) forwardInvocation: (NSInvocation*) anInvocation
41
41
gst_boxValue (argumentBuffer, args+i, [sig getArgumentTypeAtIndex: i+2 ]);
42
42
}
43
43
args[i] = NULL ;
44
-
44
+
45
+ GST_LOCK_PROXY;
45
46
OOP returnOOP = gst_proxy->vmsgSend (stObject, selector, args);
47
+ GST_UNLOCK_PROXY;
48
+
46
49
gst_unboxValue (returnOOP, (void *)returnBuffer, [sig methodReturnType ]);
47
50
[anInvocation setReturnValue: (void *)returnBuffer];
48
51
}
You can’t perform that action at this time.
0 commit comments