diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-08-03 13:40:16 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-08-03 13:40:16 +0200 |
commit | 4931526cf9b5e40294e043deab856f25bf56c7cf (patch) | |
tree | fff3eeadb6eb04edee21340ecdcdfc13da3115b4 /include | |
parent | ca494922f3815077efbcd28da3748df38c8a6961 (diff) | |
download | ouroboros-4931526cf9b5e40294e043deab856f25bf56c7cf.tar.gz ouroboros-4931526cf9b5e40294e043deab856f25bf56c7cf.zip |
lib: Revise blocking I/O
Blocking I/O now uses condition variables in the shared memory instead
of busy waiting. Timeouts can be specified. This requires the size of
the rbuffs and du_map to be the same, to guarantee that when the
shm_du_map is not full, the ap_rbuffs can't be full either.
Added the timeout option to the flow for future use.
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/config.h.in | 3 | ||||
-rw-r--r-- | include/ouroboros/shm_ap_rbuff.h | 3 | ||||
-rw-r--r-- | include/ouroboros/shm_du_map.h | 6 |
3 files changed, 10 insertions, 2 deletions
diff --git a/include/ouroboros/config.h.in b/include/ouroboros/config.h.in index 8898699c..46685569 100644 --- a/include/ouroboros/config.h.in +++ b/include/ouroboros/config.h.in @@ -40,12 +40,11 @@ #define SHM_DU_MAP_MULTI_BLOCK #define SHM_DU_MAP_FILENAME "/ouroboros.shm" #define LOCKFILE_NAME "/ouroboros.lockfile" -#define SHM_BLOCKS_IN_MAP (1 << 14) +#define SHM_BUFFER_SIZE (1 << 14) #define SHM_DU_TIMEOUT_MICROS 15000 #define DU_BUFF_HEADSPACE 128 #define DU_BUFF_TAILSPACE 0 #define SHM_AP_RBUFF_PREFIX "/ouroboros.rbuff." -#define SHM_RBUFF_SIZE (1 << 14) #define IRMD_MAX_FLOWS 4096 #define IRMD_THREADPOOL_SIZE 5 #define IRMD_FLOW_TIMEOUT 5000 /* ms */ diff --git a/include/ouroboros/shm_ap_rbuff.h b/include/ouroboros/shm_ap_rbuff.h index 257a289d..50b077f0 100644 --- a/include/ouroboros/shm_ap_rbuff.h +++ b/include/ouroboros/shm_ap_rbuff.h @@ -46,6 +46,9 @@ int shm_ap_rbuff_peek(struct shm_ap_rbuff * rb, const struct timespec * timeout); ssize_t shm_ap_rbuff_read_port(struct shm_ap_rbuff * rb, int port_id); +ssize_t shm_ap_rbuff_read_port_b(struct shm_ap_rbuff * rb, + int port_id, + const struct timespec * timeout); pid_t shm_ap_rbuff_get_api(struct shm_ap_rbuff * rb); void shm_ap_rbuff_reset(struct shm_ap_rbuff * rb); #endif /* OUROBOROS_SHM_AP_RBUFF_H */ diff --git a/include/ouroboros/shm_du_map.h b/include/ouroboros/shm_du_map.h index b9c56cf8..98013fc9 100644 --- a/include/ouroboros/shm_du_map.h +++ b/include/ouroboros/shm_du_map.h @@ -45,6 +45,12 @@ ssize_t shm_du_map_write(struct shm_du_map * dum, size_t tailspace, uint8_t * data, size_t data_len); +ssize_t shm_du_map_write_b(struct shm_du_map * dum, + pid_t dst_api, + size_t headspace, + size_t tailspace, + uint8_t * data, + size_t data_len); int shm_du_map_read(uint8_t ** dst, struct shm_du_map * dum, ssize_t idx); |