forked from len0rd/rockbox
buflib: Add pinned get/put data functions
These are more efficient than separate pin/unpin calls because pin count increment and decrement can be done cheaply when the data pointer is known. Secondly, pinned access can be made safe against preemption by hardware interrupts or other CPU cores; buflib_get_data() can't. This makes it more useful under different threading models and for SMP targets; both of which are not particularly relevant to Rockbox now, but might be in the future. Change-Id: I09284251b83bbbc59ef88a494c8fda26a7f7ef26
This commit is contained in:
parent
92565e9246
commit
800bc000a0
5 changed files with 109 additions and 35 deletions
|
@ -50,4 +50,16 @@ static inline void *buflib_get_data(struct buflib_context *ctx, int handle)
|
|||
}
|
||||
#endif
|
||||
|
||||
static inline void *buflib_get_data_pinned(struct buflib_context *ctx, int handle)
|
||||
{
|
||||
buflib_pin(ctx, handle);
|
||||
return buflib_get_data(ctx, handle);
|
||||
}
|
||||
|
||||
void _buflib_malloc_put_data_pinned(struct buflib_context *ctx, void *data);
|
||||
static inline void buflib_put_data_pinned(struct buflib_context *ctx, void *data)
|
||||
{
|
||||
_buflib_malloc_put_data_pinned(ctx, data);
|
||||
}
|
||||
|
||||
#endif /* _BUFLIB_MALLOC_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue