POSIX threads

Hello,

could you please tell me the difference between a POSIX thread and a “RIOT thread”. I see that a RIOT thread is created every time a new POSIX thread is created. Are you doing this so that you have a POSIX compliant thread API. What type I threads should I be using if I am developing new applications?

Thanks and Regards,

Abhinav

Hello Abhinav, Yes you were right: the pthreads module in RIOT provides a POSIX compliant interface to the RIOT thread architecture. So if you are writing a project just for RIOT you can savely use the normal RIOT threads provided by the core module. If you however want to write a project that runs on other (POSIX compliant) operating systems, use pthreads.

Cheers, Martine

Thanks Martine.

Regards,

Abhinav

Hello,

I just did a talk at the Sydney Internet-of-things meetup and showed my Serial<->MQTT router.

The code is here: https://github.com/clixx-io/clixx.io/blob/master/tools/serial_router.py and it's an ongoing work in progress.

The idea is to take serial port traffic on a pc/computer and route all traffic from the serial port out to the Internet via MQTT.

For the demonstration, I took and standard Arduino program that sent data via Serial.println(..) and captured that. The sensor data was then instantly rerouted to the internet via the command:

$> python tools/serial_router.py /dev/ttyUSB0 19200 berlin/riot berlin/riot_cmd

## usage: serial_router.py [-h] [-v] ## portname baudrate publish_topic subscribe_topic

The data will now get streamed worldwide via test.mosquitto.org

To view the data, simply execute the following in the command-line:

$> mosquitto_sub -h test.mosquitto.org -t berlin/riot

!390 !382 !383 !384 !379 !376 !383 !378 !279

So if anybody wants a quick and easy way to route their serial sensor values to the internet, one way is to use this IoT routing program. It's still a work in progress and I'm looking to fine-tune it but it does work as a proof-of-concept.

Regards

David