-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
451 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// Copyright (c) 2024 ZettaScale Technology | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// | ||
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
#ifndef ZENOH_PICO_COLLECTIONS_FIFO_MT_H | ||
#define ZENOH_PICO_COLLECTIONS_FIFO_MT_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "zenoh-pico/collections/element.h" | ||
#include "zenoh-pico/collections/fifo.h" | ||
#include "zenoh-pico/system/platform.h" | ||
|
||
/*-------- Fifo Buffer Multithreaded --------*/ | ||
typedef struct { | ||
_z_fifo_t _fifo; | ||
#if Z_FEATURE_MULTI_THREAD == 1 | ||
zp_mutex_t _mutex; | ||
zp_condvar_t _cv_not_full; | ||
zp_condvar_t _cv_not_empty; | ||
#endif | ||
} _z_fifo_mt_t; | ||
|
||
int8_t _z_fifo_mti_init(size_t capacity); | ||
_z_fifo_mt_t *_z_fifo_mt(size_t capacity); | ||
|
||
void _z_fifo_mt_clear(_z_fifo_mt_t *fifo, z_element_free_f free_f); | ||
void _z_fifo_mt_free(_z_fifo_mt_t *fifo, z_element_free_f free_f); | ||
|
||
int8_t _z_fifo_mt_push(const void *src, void *context, z_element_free_f element_free); | ||
|
||
int8_t _z_fifo_mt_pull(void *dst, void *context, z_element_copy_f element_copy); | ||
|
||
#endif // ZENOH_PICO_COLLECTIONS_FIFO_MT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// Copyright (c) 2024 ZettaScale Technology | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// | ||
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
#ifndef ZENOH_PICO_COLLECTIONS_RING_MT_H | ||
#define ZENOH_PICO_COLLECTIONS_RING_MT_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "zenoh-pico/collections/element.h" | ||
#include "zenoh-pico/collections/fifo.h" | ||
#include "zenoh-pico/system/platform.h" | ||
|
||
/*-------- Ring Buffer Multithreaded --------*/ | ||
typedef struct { | ||
_z_ring_t _ring; | ||
#if Z_FEATURE_MULTI_THREAD == 1 | ||
zp_mutex_t _mutex; | ||
#endif | ||
} _z_ring_mt_t; | ||
|
||
int8_t _z_ring_mt_init(_z_ring_mt_t *ring, size_t capacity); | ||
_z_ring_mt_t *_z_ring_mt(size_t capacity); | ||
|
||
void _z_ring_mt_clear(_z_ring_mt_t *ring, z_element_free_f free_f); | ||
void _z_ring_mt_free(_z_ring_mt_t *ring, z_element_free_f free_f); | ||
|
||
int8_t _z_ring_mt_push(const void *src, void *context, z_element_free_f element_free); | ||
|
||
int8_t _z_ring_mt_pull(void *dst, void *context, z_element_copy_f element_copy); | ||
|
||
#endif // ZENOH_PICO_COLLECTIONS_RING_MT_H |
Oops, something went wrong.