aboutsummaryrefslogtreecommitdiffstats
path: root/src/can-utils.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-21 12:58:09 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-21 12:58:09 +0000
commitb157cc6c5942ed0dfae672d2d3e32e0d7c6cb2ad (patch)
tree625f28c7693080a061855797dd1a6e94ee5168cd /src/can-utils.cpp
parent94d2332db42c506a275a71f6741a8cddfa9c0d6f (diff)
Fix: threads launching with wrong arguments
Fix: wrong type identifier to returned sendto function Change-Id: I33bcb84211c665720422573b04b32ca71e13d3e5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/can-utils.cpp')
-rw-r--r--src/can-utils.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/can-utils.cpp b/src/can-utils.cpp
index 7144c022..55daf440 100644
--- a/src/can-utils.cpp
+++ b/src/can-utils.cpp
@@ -17,7 +17,6 @@
#include "can-utils.hpp"
-
/********************************************************************************
*
* CanMessage method implementation
@@ -235,7 +234,7 @@ canfd_frame can_bus_dev_t::read(const struct afb_binding_interface* interface)
*/
void can_bus_dev_t::start_reading()
{
- th_reading_ = std::thread(can_reader, this);
+ th_reading_ = std::thread(can_reader, *this);
is_running_ = true;
}
@@ -300,7 +299,7 @@ bool can_bus_dev_t::has_can_message() const
*/
int can_bus_dev_t::send_can_message(can_message_t& can_msg, const struct afb_binding_interface* interface)
{
- size_t nbytes;
+ ssize_t nbytes;
canfd_frame f;
f = can_msg.convert_to_canfd_frame();
@@ -340,8 +339,8 @@ can_bus_t::can_bus_t(const afb_binding_interface *itf, int& conf_file)
*/
void can_bus_t::start_threads()
{
- th_decoding_ = std::thread(can_decoder, this);
- th_pushing_ = std::thread(can_event_push, this);
+ th_decoding_ = std::thread(can_decode_message, *this);
+ th_pushing_ = std::thread(can_event_push, *this);
}
/**
@@ -387,7 +386,7 @@ std::vector<std::string> can_bus_t::read_conf()
{
std::vector<std::string> ret;
json_object *jo, *canbus;
- int n, i, ok;
+ int n, i;
FILE *fd = fdopen(conf_file_, "r");
if (fd)
@@ -411,9 +410,8 @@ std::vector<std::string> can_bus_t::read_conf()
else
{
n = json_object_array_length(canbus);
- ok = 0;
for (i = 0 ; i < n ; i++)
- ret.push_back(json_object_get_string(json_object_array_get_idx(canbus, i)));
+ ret.push_back(json_object_get_string(json_object_array_get_idx(canbus, i)));
}
return ret;
}