Skip to content

Commit e44ae9d

Browse files
PeterPeter
authored andcommitted
Version 1.5.3 - Build on Windows cleanly and added Unix profile.
1 parent 8a32303 commit e44ae9d

3 files changed

Lines changed: 96 additions & 66 deletions

File tree

README

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ https://www.ohloh.net/p/Java-Thread-Affinity
44

55
[ Version History ]
66

7+
Version 1.5.3 - Build on Windows cleanly. Added a Unix profile for Unix enhanced build.
8+
79
Version 1.5.2 - Added Windows support and Javadoc for all public methods.
810

911
Version 1.5.1 - Add changes to support i386 and Intel i3

pom.xml

Lines changed: 87 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<groupId>vanilla.java</groupId>
2424
<artifactId>affinity</artifactId>
25-
<version>1.5.2</version>
25+
<version>1.5.3</version>
2626
<packaging>jar</packaging>
2727

2828
<licenses>
@@ -59,29 +59,93 @@
5959
</dependency>
6060
</dependencies>
6161

62+
<profiles>
63+
<profile>
64+
<id>Unix</id>
65+
66+
<build>
67+
<pluginManagement>
68+
<plugins>
69+
<plugin>
70+
<groupId>org.apache.maven.plugins</groupId>
71+
<artifactId>maven-surefire-plugin</artifactId>
72+
<version>2.9</version>
73+
<configuration>
74+
<environmentVariables>
75+
<LD_LIBRARY_PATH>target/classes</LD_LIBRARY_PATH>
76+
<DYLD_LIBRARY_PATH>target/classes</DYLD_LIBRARY_PATH>
77+
</environmentVariables>
78+
</configuration>
79+
</plugin>
80+
</plugins>
81+
</pluginManagement>
82+
<plugins>
83+
84+
<!-- TODO make git remember that the file should be executable -->
85+
<plugin>
86+
<artifactId>maven-antrun-plugin</artifactId>
87+
<version>1.7</version>
88+
<executions>
89+
<execution>
90+
<id>build-native</id>
91+
<phase>process-classes</phase>
92+
<goals>
93+
<goal>run</goal>
94+
</goals>
95+
<configuration>
96+
<target>
97+
<property name="makefile"
98+
value="${project.basedir}/${native.source.dir}/Makefile"/>
99+
<!-- make it executable -->
100+
<chmod file="${makefile}" perm="u+x"/>
101+
</target>
102+
</configuration>
103+
104+
</execution>
105+
</executions>
106+
</plugin>
107+
108+
<plugin>
109+
<groupId>org.codehaus.mojo</groupId>
110+
<artifactId>exec-maven-plugin</artifactId>
111+
<version>1.2.1</version>
112+
<executions>
113+
<execution>
114+
<!-- this execution happens just after compiling the java classes, and builds the native code. -->
115+
<id>build-native</id>
116+
<phase>process-classes</phase>
117+
<goals>
118+
<goal>exec</goal>
119+
</goals>
120+
<configuration>
121+
<executable>src/main/c/Makefile</executable>
122+
<workingDirectory>src/main/c</workingDirectory>
123+
</configuration>
124+
</execution>
125+
</executions>
126+
</plugin>
127+
</plugins>
128+
</build>
129+
</profile>
130+
</profiles>
131+
62132
<build>
63-
<extensions>
64-
<extension>
65-
<groupId>org.jvnet.wagon-svn</groupId>
66-
<artifactId>wagon-svn</artifactId>
67-
<version>1.8</version>
68-
</extension>
69-
</extensions>
70-
<pluginManagement>
71-
<plugins>
72-
<plugin>
73-
<groupId>org.apache.maven.plugins</groupId>
74-
<artifactId>maven-surefire-plugin</artifactId>
75-
<version>2.9</version>
76-
<configuration>
77-
<environmentVariables>
78-
<LD_LIBRARY_PATH>target/classes</LD_LIBRARY_PATH>
79-
<DYLD_LIBRARY_PATH>target/classes</DYLD_LIBRARY_PATH>
80-
</environmentVariables>
81-
</configuration>
82-
</plugin>
83-
</plugins>
84-
</pluginManagement>
133+
<pluginManagement>
134+
<plugins>
135+
<plugin>
136+
<groupId>org.apache.maven.plugins</groupId>
137+
<artifactId>maven-surefire-plugin</artifactId>
138+
<version>2.9</version>
139+
<configuration>
140+
<environmentVariables>
141+
<LD_LIBRARY_PATH>target/classes</LD_LIBRARY_PATH>
142+
<DYLD_LIBRARY_PATH>target/classes</DYLD_LIBRARY_PATH>
143+
</environmentVariables>
144+
</configuration>
145+
</plugin>
146+
</plugins>
147+
</pluginManagement>
148+
85149
<plugins>
86150
<plugin>
87151
<artifactId>maven-compiler-plugin</artifactId>
@@ -92,49 +156,6 @@
92156
</configuration>
93157
</plugin>
94158

95-
<!-- TODO make git remember that the file should be executable -->
96-
<plugin>
97-
<artifactId>maven-antrun-plugin</artifactId>
98-
<version>1.7</version>
99-
<executions>
100-
<execution>
101-
<id>build-native</id>
102-
<phase>process-classes</phase>
103-
<goals>
104-
<goal>run</goal>
105-
</goals>
106-
<configuration>
107-
<target>
108-
<property name="makefile" value="${project.basedir}/${native.source.dir}/Makefile"/>
109-
<!-- make it executable -->
110-
<chmod file="${makefile}" perm="u+x"/>
111-
</target>
112-
</configuration>
113-
114-
</execution>
115-
</executions>
116-
</plugin>
117-
118-
<plugin>
119-
<groupId>org.codehaus.mojo</groupId>
120-
<artifactId>exec-maven-plugin</artifactId>
121-
<version>1.2.1</version>
122-
<executions>
123-
<execution>
124-
<!-- this execution happens just after compiling the java classes, and builds the native code. -->
125-
<id>build-native</id>
126-
<phase>process-classes</phase>
127-
<goals>
128-
<goal>exec</goal>
129-
</goals>
130-
<configuration>
131-
<executable>src/main/c/Makefile</executable>
132-
<workingDirectory>src/main/c</workingDirectory>
133-
</configuration>
134-
</execution>
135-
</executions>
136-
</plugin>
137-
138159
<plugin>
139160
<artifactId>maven-source-plugin</artifactId>
140161
<version>2.1.2</version>

src/test/java/vanilla/java/busywaiting/impl/JNIBusyWaitingTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package vanilla.java.busywaiting.impl;
1818

19+
import com.sun.jna.Platform;
1920
import org.junit.Test;
2021
import sun.nio.ch.DirectBuffer;
2122

@@ -29,6 +30,8 @@
2930
public class JNIBusyWaitingTest {
3031
@Test
3132
public void testPause() {
33+
if (!Platform.isLinux()) return;
34+
3235
int runs = 2000000;
3336
long start = System.nanoTime();
3437
for (int i = 0; i < runs; i++)
@@ -39,6 +42,8 @@ public void testPause() {
3942

4043
@Test
4144
public void testWhileEqual() {
45+
if (!Platform.isLinux()) return;
46+
4247
DirectBuffer buffer = (DirectBuffer) ByteBuffer.allocateDirect(8);
4348
int runs = 100000000;
4449
long start = System.nanoTime();
@@ -49,6 +54,8 @@ public void testWhileEqual() {
4954

5055
@Test
5156
public void testWhileLessThan() {
57+
if (!Platform.isLinux()) return;
58+
5259
DirectBuffer buffer = (DirectBuffer) ByteBuffer.allocateDirect(8);
5360
int runs = 100000000;
5461
long start = System.nanoTime();

0 commit comments

Comments
 (0)