Skip to content

Commit

Permalink
Incorporate the new delayed-free code.
Browse files Browse the repository at this point in the history
  • Loading branch information
schani committed Sep 13, 2013
1 parent a8da218 commit eeb438a
Show file tree
Hide file tree
Showing 13 changed files with 339 additions and 276 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
8E9E685917E286EC00D29ABA /* lock-free-array-queue.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E9E685717E286EC00D29ABA /* lock-free-array-queue.c */; };
8EA0D32717E1153900A63F1D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8EA0D32617E1153900A63F1D /* UIKit.framework */; };
8EA0D32917E1153900A63F1D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8EA0D32817E1153900A63F1D /* Foundation.framework */; };
8EA0D32B17E1153900A63F1D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8EA0D32A17E1153900A63F1D /* CoreGraphics.framework */; };
Expand All @@ -16,7 +17,6 @@
8EA0D33917E1153900A63F1D /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 8EA0D33817E1153900A63F1D /* Default.png */; };
8EA0D33B17E1153900A63F1D /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8EA0D33A17E1153900A63F1D /* Default@2x.png */; };
8EA0D33D17E1153900A63F1D /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8EA0D33C17E1153900A63F1D /* Default-568h@2x.png */; };
8EA0D35817E1158100A63F1D /* delayed-free.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EA0D34517E1158100A63F1D /* delayed-free.c */; };
8EA0D35917E1158100A63F1D /* hazard-pointer.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EA0D34717E1158100A63F1D /* hazard-pointer.c */; };
8EA0D35A17E1158100A63F1D /* lock-free-alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EA0D34917E1158100A63F1D /* lock-free-alloc.c */; };
8EA0D35B17E1158100A63F1D /* lock-free-queue.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EA0D34B17E1158100A63F1D /* lock-free-queue.c */; };
Expand All @@ -27,6 +27,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
8E9E685717E286EC00D29ABA /* lock-free-array-queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "lock-free-array-queue.c"; path = "../../lock-free-array-queue.c"; sourceTree = "<group>"; };
8E9E685817E286EC00D29ABA /* lock-free-array-queue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "lock-free-array-queue.h"; path = "../../lock-free-array-queue.h"; sourceTree = "<group>"; };
8EA0D32317E1153900A63F1D /* LockFreeAllocatorTester.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LockFreeAllocatorTester.app; sourceTree = BUILT_PRODUCTS_DIR; };
8EA0D32617E1153900A63F1D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
8EA0D32817E1153900A63F1D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
Expand All @@ -42,7 +44,6 @@
8EA0D33C17E1153900A63F1D /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
8EA0D34317E1158100A63F1D /* alloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = alloc.h; path = ../../alloc.h; sourceTree = "<group>"; };
8EA0D34417E1158100A63F1D /* atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = atomic.h; path = ../../atomic.h; sourceTree = "<group>"; };
8EA0D34517E1158100A63F1D /* delayed-free.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "delayed-free.c"; path = "../../delayed-free.c"; sourceTree = "<group>"; };
8EA0D34617E1158100A63F1D /* delayed-free.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "delayed-free.h"; path = "../../delayed-free.h"; sourceTree = "<group>"; };
8EA0D34717E1158100A63F1D /* hazard-pointer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "hazard-pointer.c"; path = "../../hazard-pointer.c"; sourceTree = "<group>"; };
8EA0D34817E1158100A63F1D /* hazard-pointer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "hazard-pointer.h"; path = "../../hazard-pointer.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -105,9 +106,10 @@
8EA0D32C17E1153900A63F1D /* LockFreeAllocatorTester */ = {
isa = PBXGroup;
children = (
8E9E685717E286EC00D29ABA /* lock-free-array-queue.c */,
8E9E685817E286EC00D29ABA /* lock-free-array-queue.h */,
8EA0D34317E1158100A63F1D /* alloc.h */,
8EA0D34417E1158100A63F1D /* atomic.h */,
8EA0D34517E1158100A63F1D /* delayed-free.c */,
8EA0D34617E1158100A63F1D /* delayed-free.h */,
8EA0D34717E1158100A63F1D /* hazard-pointer.c */,
8EA0D34817E1158100A63F1D /* hazard-pointer.h */,
Expand Down Expand Up @@ -213,14 +215,14 @@
files = (
8EA0D33317E1153900A63F1D /* main.m in Sources */,
8EA0D33717E1153900A63F1D /* XAMAppDelegate.m in Sources */,
8EA0D35817E1158100A63F1D /* delayed-free.c in Sources */,
8EA0D35917E1158100A63F1D /* hazard-pointer.c in Sources */,
8EA0D35A17E1158100A63F1D /* lock-free-alloc.c in Sources */,
8EA0D35B17E1158100A63F1D /* lock-free-queue.c in Sources */,
8EA0D35C17E1158100A63F1D /* mono-linked-list-set.c in Sources */,
8EA0D35D17E1158100A63F1D /* mono-mmap.c in Sources */,
8EA0D35E17E1158100A63F1D /* sgen-gc.c in Sources */,
8EA0D36017E1158100A63F1D /* test.c in Sources */,
8E9E685917E286EC00D29ABA /* lock-free-array-queue.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ all : test
%.o : %.c
gcc $(CFLAGS) -c $<

delayed-free.o : delayed-free.c
hazard-pointer.o : hazard-pointer.c
gcc $(CFLAGS) -c $<

hazard-pointer.o : hazard-pointer.c
lock-free-array-queue.o : lock-free-array-queue.c
gcc $(CFLAGS) -c $<

lock-free-queue.o : lock-free-queue.c
Expand All @@ -32,8 +32,8 @@ mono-linked-list-set.o : mono-linked-list-set.c
test.o : test.c
gcc $(CFLAGS) -c $<

test : hazard-pointer.o $(QUEUE).o $(ALLOC).o mono-mmap.o sgen-gc.o delayed-free.o mono-linked-list-set.o test.o
gcc $(OPT) -g -Wall -o test hazard-pointer.o $(QUEUE).o $(ALLOC).o mono-mmap.o sgen-gc.o delayed-free.o mono-linked-list-set.o test.o -lpthread
test : hazard-pointer.o lock-free-array-queue.o $(QUEUE).o $(ALLOC).o mono-mmap.o sgen-gc.o mono-linked-list-set.o test.o
gcc $(OPT) -g -Wall -o test hazard-pointer.o lock-free-array-queue.o $(QUEUE).o $(ALLOC).o mono-mmap.o sgen-gc.o mono-linked-list-set.o test.o -lpthread

clean :
rm -f *.o test
2 changes: 2 additions & 0 deletions atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* (C) 2002 Ximian, Inc.
*/

#include "fake-glib.h"

#ifndef _WAPI_ATOMIC_H_
#define _WAPI_ATOMIC_H_

Expand Down
190 changes: 0 additions & 190 deletions delayed-free.c

This file was deleted.

12 changes: 0 additions & 12 deletions delayed-free.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
#ifndef __MONO_UTILS_DELAYED_FREE_H__
#define __MONO_UTILS_DELAYED_FREE_H__

#include "fake-glib.h"
#include <pthread.h>

#define CRITICAL_SECTION pthread_mutex_t
#define EnterCriticalSection pthread_mutex_lock
#define LeaveCriticalSection pthread_mutex_unlock

typedef void (*MonoHazardousFreeFunc) (gpointer p);

typedef struct {
gpointer p;
MonoHazardousFreeFunc free_func;
} MonoDelayedFreeItem;

void mono_delayed_free_push (MonoDelayedFreeItem item);

gboolean mono_delayed_free_pop (MonoDelayedFreeItem *item);

#endif
Loading

0 comments on commit eeb438a

Please sign in to comment.