Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tp2_prog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
william.ho
Tp2_prog
Commits
53f9c94d
Commit
53f9c94d
authored
1 year ago
by
ricardo.dossanto1
Browse files
Options
Downloads
Patches
Plain Diff
Delete queue_mgt.h
parent
d3cc3597
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
queue_mgt.h
+0
-61
0 additions, 61 deletions
queue_mgt.h
with
0 additions
and
61 deletions
queue_mgt.h
deleted
100644 → 0
+
0
−
61
View file @
d3cc3597
#ifndef QUEUE_MGT_H
#define QUEUE_MGT_H
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
<pthread.h>
#include
<assert.h>
#include
<semaphore.h>
#include
<unistd.h>
#include
<stdbool.h>
#include
<stdint.h>
typedef
struct
{
int
head
;
int
tail
;
int
count
;
// Nombre d'éléments actuellement dans la file
int
size
;
// Taille en octets d'un élément de la file
int
capacity
;
// Nombre maximal d'éléments pouvant être stockés dans la file
void
*
buffer
;
// Tampon de la file
pthread_mutex_t
*
mutex
;
sem_t
*
used
;
sem_t
*
libre
;
bool
closed
;
bool
endTask
;
}
queue_t
;
/* Description: queue initialization
Parameters: queue: pointer on the queue handle (contains internal parameters)
element_byte_size_max: number of byte of a single element of the queue
nb_of_elements_max: maximum number of element the queue can contain
Return: error code or 0 on success
*/
int
init_queue
(
queue_t
*
queue
,
int
element_byte_size_max
,
int
nb_of_elements_max
);
/* Description: queue destruction. Unlock potential blocking functions in send() and
receive() are stopped. The all ressources are freed.
Parameters: queue: pointer on the queue handle
*/
void
destroy_queue
(
queue_t
*
queue
);
/* Description: send an element in a queue. This function blocks if the queue is full,
waiting that at least one element has been read.
Parameters: queue: pointer on the queue handle
element: pointer on the element to send
*/
void
send
(
queue_t
*
queue
,
void
*
element
);
/* Description: receive an element from a queue. This function blocks if the queue is empty,
waiting that at least one element has been written into it.
Parameters: queue: pointer on the queue handle
element: pointer on the element to receive
*/
void
receive
(
queue_t
*
queue
,
void
*
element
);
/*
* Description: close queue since destroying all queues in task f seems to be an unpredicatble behaviour
* it will also tell the end of the task the queue was in
* Parameters: the queue pointer
*/
void
close_queue
(
queue_t
*
queue
);
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment