Skip to content

Commit 5d22dfc

Browse files
committed
Trying a less threaded version of core zcm
1 parent a120ba6 commit 5d22dfc

39 files changed

Lines changed: 606 additions & 1017 deletions

docs/lcm_to_zcm.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ allows LCM users to gradually migrate to ZCM.
7171

7272
### Known incompatibilities:
7373
- `zcm_get_fileno()` is not supported
74-
- `zcm_handle_timeout()` is not supported
7574
- `zcm_subscription_set_queue_capacity` is not supported
7675
- LCMType-style enums are not supported
7776
- Language bindings not currently supported:

docs/transports.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,14 @@ By default, this number is 512.
279279

280280
- `int update(zcm_trans_t *zt)`
281281

282-
This method is called from the `zcm_handle_nonblock()` function.
282+
This method is called from the `zcm_handle()` function.
283283
This method provides a periodically-running routine that can perform
284284
updates to the underlying hardware or other general maintenance to
285285
this transport. A transport implementing this function will typically use
286286
this time to flush out any bytes left in its internal buffer. This method
287287
should **never block**. Again, this method is called from
288-
`zcm_handle_nonblock()` and thus runs at the same frequency as
289-
`zcm_handle_nonblock()`. Failure to call `zcm_handle_nonblock()`
288+
`zcm_handle()` and thus runs at the same frequency as
289+
`zcm_handle()`. Failure to call `zcm_handle()`
290290
while using an nonblock transport may cause the transport to work
291291
incorrectly on both message send and recv.
292292

@@ -354,7 +354,7 @@ For the blocking case, there are the following approaches:
354354

355355
For the non-blocking case, there is a single approach:
356356

357-
- `zcm_handle_nonblock() /* returns non-zero if a message was available and dispatched */`
357+
- `zcm_handle() /* returns non-zero if a message was available and dispatched */`
358358

359359
To prevent errors, the internal library checks that the API method matches the transport type.
360360

examples/c/nblock_inproc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
6262
my_data.timestamp = i;
6363
example_t_publish(&zcm, "EXAMPLE", &my_data);
6464
usleep(100000);
65-
zcm_handle_nonblock(&zcm);
65+
zcm_handle(&zcm, 0);
6666
}
6767

6868
free(my_data.ranges);

examples/c/pub.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ int main(int argc, char *argv[])
4040
my_data.name = EXAMPLE_T_test_const_string;
4141
my_data.enabled = 1;
4242

43+
uint64_t sleepUs = 1000000/HZ;
4344
while (1) {
4445
if (example_t_publish(zcm, "EXAMPLE", &my_data) == 0)
4546
++my_data.timestamp;
46-
usleep(1000000/HZ);
47+
if (sleepUs > 0) usleep(sleepUs);
4748
}
4849

4950
zcm_destroy(zcm);

examples/cpp/Unsub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void dispatchOneMessage(zcm::ZCM& zcm, uint64_t sleepTimeUs)
3939
} else {
4040
uint64_t end = utime() + sleepTimeUs;
4141
while (utime() < end) {
42-
if (zcm.handleNonblock() == ZCM_EOK) break;
42+
if (zcm.handle(0) == ZCM_EOK) break;
4343
}
4444
}
4545
}

examples/cpp/transport/SerialTransportTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ int main(int argc, const char *argv[])
9292
nextPublish = now + PUBLISH_DT;
9393
}
9494

95-
zcmLocal.handleNonblock();
95+
zcmLocal.handle(0);
9696
}
9797

9898
zcmLocal.unsubscribe(sub);

examples/julia/nonblock_test.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ msg = example_t()
2121

2222
msg.timestamp = 0;
2323
publish(zcm, "EXAMPLE", msg)
24-
handle_nonblock(zcm)
24+
handle(zcm, 0)
2525
msg.timestamp = 1;
2626
publish(zcm, "EXAMPLE", msg)
27-
handle_nonblock(zcm)
27+
handle(zcm, 0)
2828
msg.timestamp = 2;
2929
publish(zcm, "EXAMPLE", msg)
30-
handle_nonblock(zcm)
30+
handle(zcm, 0)
3131

3232
unsubscribe(zcm, sub)
3333

examples/node-client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zcm-example",
3-
"version": "1.1.5",
3+
"version": "2.0.0",
44
"description": "",
55
"scripts": {
66
"//": [
@@ -14,6 +14,6 @@
1414
"big-integer": "^1.6.27",
1515
"express": "^4.14.0",
1616
"ref-napi": "^3.0.0",
17-
"zerocm": "file:../../../../../../usr/local/share/node/zerocm-1.1.5.tgz"
17+
"zerocm": "file:../../../../../../usr/local/share/node/zerocm-2.0.0.tgz"
1818
}
1919
}

examples/python/handle_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def handler(channel, msg):
2323
msg = example_t()
2424
msg.timestamp = 10
2525

26-
ret = zcm.handleNonblock()
26+
ret = zcm.handle(0)
2727
if ret != zerocm.ZCM_EAGAIN:
2828
print("Failed to return successfully when no message is ready")
2929
sys.exit(1)
@@ -44,7 +44,7 @@ def handler(channel, msg):
4444
time.sleep(0.5)
4545

4646
# handle incoming message
47-
ret = zcm.handleNonblock()
47+
ret = zcm.handle(0)
4848
if ret != zerocm.ZCM_EOK:
4949
print("Failed to return successfully when a message is ready")
5050
sys.exit(1)

gen/version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ifndef _VERSION_H
22
#define _VERSION_H
33

4-
#define ZCM_MAJOR_VERSION 1
5-
#define ZCM_MINOR_VERSION 1
6-
#define ZCM_MICRO_VERSION 5
4+
#define ZCM_MAJOR_VERSION 2
5+
#define ZCM_MINOR_VERSION 0
6+
#define ZCM_MICRO_VERSION 0
77

88
#endif

0 commit comments

Comments
 (0)