Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
paho.mqtt.c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eclipse
paho.mqtt.c
Commits
a94f10ec
Commit
a94f10ec
authored
Mar 23, 2017
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MacOS updates for threading
parent
5db08261
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
13 deletions
+16
-13
Makefile
Makefile
+2
-1
Thread.c
src/Thread.c
+3
-3
mqttsas2.py
test/mqttsas2.py
+10
-8
test1.c
test/test1.c
+1
-1
No files found.
Makefile
View file @
a94f10ec
...
@@ -164,11 +164,12 @@ END_GROUP =
...
@@ -164,11 +164,12 @@ END_GROUP =
EXTRA_LIB
=
-ldl
EXTRA_LIB
=
-ldl
CCFLAGS_SO
+=
-Wno-deprecated-declarations
-D
USE_NAMED_SEMAPHORES
CCFLAGS_SO
+=
-Wno-deprecated-declarations
-D
OSX
LDFLAGS_C
+=
-Wl
,-install_name,lib
$(MQTTLIB_C)
.so.
${
MAJOR_VERSION
}
LDFLAGS_C
+=
-Wl
,-install_name,lib
$(MQTTLIB_C)
.so.
${
MAJOR_VERSION
}
LDFLAGS_CS
+=
-Wl
,-install_name,lib
$(MQTTLIB_CS)
.so.
${
MAJOR_VERSION
}
LDFLAGS_CS
+=
-Wl
,-install_name,lib
$(MQTTLIB_CS)
.so.
${
MAJOR_VERSION
}
LDFLAGS_A
+=
-Wl
,-install_name,lib
${
MQTTLIB_A
}
.so.
${
MAJOR_VERSION
}
LDFLAGS_A
+=
-Wl
,-install_name,lib
${
MQTTLIB_A
}
.so.
${
MAJOR_VERSION
}
LDFLAGS_AS
+=
-Wl
,-install_name,lib
${
MQTTLIB_AS
}
.so.
${
MAJOR_VERSION
}
LDFLAGS_AS
+=
-Wl
,-install_name,lib
${
MQTTLIB_AS
}
.so.
${
MAJOR_VERSION
}
FLAGS_EXE
+=
-DOSX
endif
endif
...
...
src/Thread.c
View file @
a94f10ec
...
@@ -196,7 +196,7 @@ sem_type Thread_create_sem(void)
...
@@ -196,7 +196,7 @@ sem_type Thread_create_sem(void)
NULL
// object name
NULL
// object name
);
);
#elif defined(OSX)
#elif defined(OSX)
sem
=
dispatch_semaphore_create
(
0L
);
sem
=
dispatch_semaphore_create
(
0L
);
rc
=
(
sem
==
NULL
)
?
-
1
:
0
;
rc
=
(
sem
==
NULL
)
?
-
1
:
0
;
#else
#else
sem
=
malloc
(
sizeof
(
sem_t
));
sem
=
malloc
(
sizeof
(
sem_t
));
...
@@ -234,7 +234,7 @@ int Thread_wait_sem(sem_type sem, int timeout)
...
@@ -234,7 +234,7 @@ int Thread_wait_sem(sem_type sem, int timeout)
#if defined(WIN32) || defined(WIN64)
#if defined(WIN32) || defined(WIN64)
rc
=
WaitForSingleObject
(
sem
,
timeout
);
rc
=
WaitForSingleObject
(
sem
,
timeout
);
#elif defined(OSX)
#elif defined(OSX)
rc
=
(
int
)
dispatch_semaphore_wait
(
sem
,
dispatch_time
(
DISPATCH_TIME_NOW
,
timeout
*
1000
));
rc
=
(
int
)
dispatch_semaphore_wait
(
sem
,
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)
timeout
*
1000000L
));
#elif defined(USE_TRYWAIT)
#elif defined(USE_TRYWAIT)
while
(
++
i
<
count
&&
(
rc
=
sem_trywait
(
sem
))
!=
0
)
while
(
++
i
<
count
&&
(
rc
=
sem_trywait
(
sem
))
!=
0
)
{
{
...
@@ -291,7 +291,7 @@ int Thread_post_sem(sem_type sem)
...
@@ -291,7 +291,7 @@ int Thread_post_sem(sem_type sem)
if
(
SetEvent
(
sem
)
==
0
)
if
(
SetEvent
(
sem
)
==
0
)
rc
=
GetLastError
();
rc
=
GetLastError
();
#elif defined(OSX)
#elif defined(OSX)
rc
=
(
int
)
dispatch_semaphore_signal
(
sem
);
rc
=
(
int
)
dispatch_semaphore_signal
(
sem
);
#else
#else
if
(
sem_post
(
sem
)
==
-
1
)
if
(
sem_post
(
sem
)
==
-
1
)
rc
=
errno
;
rc
=
errno
;
...
...
test/mqttsas2.py
View file @
a94f10ec
"""
"""
*******************************************************************
*******************************************************************
Copyright (c) 2013, 201
6
IBM Corp.
Copyright (c) 2013, 201
7
IBM Corp.
All rights reserved. This program and the accompanying materials
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
are made available under the terms of the Eclipse Public License v1.0
and Eclipse Distribution License v1.0 which accompany this distribution.
and Eclipse Distribution License v1.0 which accompany this distribution.
The Eclipse Public License is available at
The Eclipse Public License is available at
http://www.eclipse.org/legal/epl-v10.html
http://www.eclipse.org/legal/epl-v10.html
and the Eclipse Distribution License is available at
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php.
http://www.eclipse.org/org/documents/edl-v10.php.
Contributors:
Contributors:
Ian Craggs - initial implementation and/or documentation
Ian Craggs - initial implementation and/or documentation
*******************************************************************
*******************************************************************
...
@@ -45,7 +45,8 @@ class MyHandler(socketserver.StreamRequestHandler):
...
@@ -45,7 +45,8 @@ class MyHandler(socketserver.StreamRequestHandler):
clients
=
self
.
request
clients
=
self
.
request
brokers
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
brokers
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
brokers
.
connect
((
brokerhost
,
brokerport
))
brokers
.
connect
((
brokerhost
,
brokerport
))
while
inbuf
!=
None
:
terminated
=
False
while
inbuf
!=
None
and
not
terminated
:
(
i
,
o
,
e
)
=
select
.
select
([
clients
,
brokers
],
[],
[])
(
i
,
o
,
e
)
=
select
.
select
([
clients
,
brokers
],
[],
[])
for
s
in
i
:
for
s
in
i
:
if
s
==
clients
:
if
s
==
clients
:
...
@@ -60,6 +61,7 @@ class MyHandler(socketserver.StreamRequestHandler):
...
@@ -60,6 +61,7 @@ class MyHandler(socketserver.StreamRequestHandler):
print
(
"Terminating client"
,
self
.
ids
[
id
(
clients
)])
print
(
"Terminating client"
,
self
.
ids
[
id
(
clients
)])
brokers
.
close
()
brokers
.
close
()
clients
.
close
()
clients
.
close
()
terminated
=
True
break
break
elif
packet
.
fh
.
MessageType
==
MQTTV3
.
CONNECT
:
elif
packet
.
fh
.
MessageType
==
MQTTV3
.
CONNECT
:
self
.
ids
[
id
(
clients
)]
=
packet
.
ClientIdentifier
self
.
ids
[
id
(
clients
)]
=
packet
.
ClientIdentifier
...
...
test/test1.c
View file @
a94f10ec
...
@@ -955,7 +955,7 @@ int test6(struct Options options)
...
@@ -955,7 +955,7 @@ int test6(struct Options options)
opts
.
keepAliveInterval
=
2
;
opts
.
keepAliveInterval
=
2
;
opts
.
cleansession
=
1
;
opts
.
cleansession
=
1
;
opts
.
MQTTVersion
=
options
.
MQTTVersion
;
opts
.
MQTTVersion
=
MQTTVERSION_3_1_1
;
opts
.
will
=
&
wopts
;
opts
.
will
=
&
wopts
;
opts
.
will
->
message
=
test6_will_message
;
opts
.
will
->
message
=
test6_will_message
;
opts
.
will
->
qos
=
1
;
opts
.
will
->
qos
=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment