Skip to content

Commit 01acb59

Browse files
committed
The threadId must be an unsigned 16 bit
1 parent 1ae143e commit 01acb59

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

affinity/src/main/java/net/openhft/affinity/impl/OSXJNAAffinity.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ public int getProcessId() {
6060
@Override
6161
public int getThreadId() {
6262
final CLibrary lib = CLibrary.INSTANCE;
63-
return CLibrary.INSTANCE.pthread_self();
63+
int tid = CLibrary.INSTANCE.pthread_self();
64+
//The tid must be an unsigned 16 bit
65+
short s_tid = (short)tid;
66+
return s_tid;
6467
}
6568

6669
interface CLibrary extends Library {

0 commit comments

Comments
 (0)