Protothreads | Protothreads from http : //dunkels.com/adam/pt/
kandi X-RAY | Protothreads Summary
kandi X-RAY | Protothreads Summary
Protothreads are extremely lightweight stackless threads designed for severely memory constrained systems such as small embedded systems or sensor network nodes. Protothreads can be used with or without an underlying operating system. Protothreads provides a blocking context on top of an event-driven system, without the overhead of per-thread stacks. The purpose of protothreads is to implement sequential flow of control without complex state machines or full multi-threading. The protothreads library is released under an open source BSD-style license that allows for both non-commercial and commercial usage. The only requirement is that credit is given. The protothreads library was written by Adam Dunkels adam@sics.se with support from Oliver Schmidt ol.sc@web.de. More information and new versions can be found at the protothreads homepage: Documentation can be found in the doc/ subdirectory.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Protothreads
Protothreads Key Features
Protothreads Examples and Code Snippets
Community Discussions
Trending Discussions on Protothreads
QUESTION
Because the in built list provided by Contiki doesn't fit my needs (uses too much memory) I have implemented my own list version that has been optimized for how I intend to use it.
At any one time there will be a single one of these lists that will be operated on (i.e. add/remove elements) by multiple processes/protothreads. However, additions/removals do not occur within a process/protothread block, but instead are called within a function that is called through a series of function calls initiated by a process/protothread.
For example,
...ANSWER
Answered 2018-May-29 at 12:18You seem to be confused about what protothreads do. The protothread approach is a form of cooperative scheduling. A protothread can only yield at specific points, when asked to yield by the execution flow. An interrupt can never switch the execution flow to another protothread.
So, there are two distinct options:
1) If your list is accessed both from protothread and from interrupt handler contexts, you need to do all modifications in the list with interrupts disabled. So your lock/unlock code is disable/enable interrupts, respectively.
2) If your list is only accessed from protothreads, you don't need any locking. This is the recommended design.
Indeed, the main advantage of using protothreads is that in 99% of cases locks are not needed.
QUESTION
Thanks in advance for the help.
First a preface. I have been looking at using the Contiki TSCH implementation given at https://github.com/contiki-os/contiki/tree/master/core/net/mac/tsch. While running a simple example in the Cooja simulator (with a few log messages that I have added to the base code so I can see what's going on) I noticed that the ASN counter was not incrementing its most significant byte.
Specifically, the ASN (absolute slot number for TSCH) is given by the struct
...ANSWER
Answered 2018-May-22 at 14:10It looks like mismatch between printf specifiers and actual argument types happening on 16-bit architecture. It is recommended to use specifiers defined as format macro constants in inttypes.h
for all integer types coming from stdint.h
I.e. when x
is of type uint32_t
you shall use
QUESTION
I have a part of a library that processes data and takes quite a long time. In some cases it's not possible to wait for the results of the function but there are other tasks that should be done. On a system with an OS that's not a problem, as the scheduler can help with that. But there are also systems that have no OS available. On these systems I want to achieve something similiar, i.e. the function is called does some calculations and returns after a given period (say 10ms). Then the other things are done and the data processing function gets called again and takes off at the position it left.
...ANSWER
Answered 2017-Feb-14 at 13:06As long as other_stuff
is reasonably short, you can do it in a timer ISR.
In case you don't want to use the task context savings of an (RT)OS, you have to implement them on your own - break your long-running processing function down into pieces, save the processing context and return to your main dispatching point. After the next step is done, come back to the saved context and re-start processing where you left off. (This is more or less what protothreads do)
The end consequence is that once you're done, you might have implemented most of the parts of a multitasking time-slicing OS.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Protothreads
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page