-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: mbox: initial commit #4919
Conversation
Not tested, but at least code-wise it looks simpler then my implementation. However: I would prefer putting the non-mbox related changes to core into a separate commit. |
This is based on #4557, right? |
Ah, yes... |
}; | ||
|
||
void mbox_put(mbox_t *mbox, msg_t *msg); | ||
int mbox_tryput(mbox_t *mbox, msg_t *msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For API consistency: mbox_try_put()
I really would like to have this soonish (though lwIP is already winning time-wise despite my crappy-mbox API :P) |
@authmillenon Sorry, I found a flaw in the logic. Will have to fix that first. |
Kk. Thesis evaluation is done anyways. Mentioned this PR as an optimization possibility, but used my mbox implementation for the actual comparison. |
Fixes #4342 |
(please rebase) |
I un-marked WIP as it should be usable now. Let's add timeout versions later. |
As this is very unintrusive, we could think about merging for the release, marking it as experimental? |
#if defined(MODULE_CORE_MSG) || defined(MODULE_CORE_THREAD_FLAGS) | ||
void *wait_data; /**< used by msg and thread flags */ | ||
#if defined(MODULE_CORE_MSG) || defined(MODULE_CORE_THREAD_FLAGS) \ | ||
|| defined(MODULE_MBOX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does that module gets defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nowhere. fixed.
#endif | ||
|
||
/** Static initializer for mbox objects */ | ||
#define MBOX_INIT(queue, queue_size) {{0}, {0}, CIB_INIT(queue_size), queue, NULL} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs a dynamic initializer e.g.:
static inline void mbox_init(mbox_t *mbox, msg_t queue, unsigned int queue_size)
{
mbox_t m = MBOX_INIT(queue, queue_size);
*mbox = m;
}
so you can (re-)initialize the variable at other points than variable definition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
|
@miri64 ACK still stands? |
|
||
#ifndef MODULE_CORE_MBOX | ||
#error mbox depends on the module core_mbox! | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this is superfluous. The linker will yield an error anyway.
Apart from comment above, yes :-) |
|
Looks good from what I can see. |
AVR and MSP430 are butthurt about something. |
Ping? |
Hm, that seems to be a compiler problem. My arch avr-gcc (5.3.0) compiles the code just fine, the one used by murdock doesn't. |
|
Turns out there was an excess initializer. Makes me wonder why the other compilers didn't choke on that.
|
two ACKs -> go |
Alternative to #4552.
differences:
WIP:
(
timeout functions missing) postponed