Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Ordonnancement
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
ASE-2021
Ordonnancement
Commits
c72e7f1f
Commit
c72e7f1f
authored
4 years ago
by
Thierno souleymane Bah
Browse files
Options
Downloads
Patches
Plain Diff
fix(issue concerning ctx fixed, now finish correctly)
parent
14d1d975
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pingpongpang.c
+1
-1
1 addition, 1 deletion
pingpongpang.c
try.c
+23
-1
23 additions, 1 deletion
try.c
with
24 additions
and
2 deletions
pingpongpang.c
+
1
−
1
View file @
c72e7f1f
...
@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
...
@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
printf
(
"Begin
\n
"
);
printf
(
"Begin
\n
"
);
yield
();
yield
();
printf
(
"End
\n
"
);
printf
(
"End
\n
"
);
exit
(
EXIT_SUCCESS
)
;
return
EXIT_SUCCESS
;
}
}
void
f_ping
(
void
*
args
)
void
f_ping
(
void
*
args
)
...
...
This diff is collapsed.
Click to expand it.
try.c
+
23
−
1
View file @
c72e7f1f
#include
<stdlib.h>
#include
<stdlib.h>
#include
<stdio.h>
#include
<assert.h>
#include
<assert.h>
#include
"try.h"
#include
"try.h"
...
@@ -43,6 +44,21 @@ int init_ctx(ctx_t *pctx, int stack_size, funct_t f, void *args)
...
@@ -43,6 +44,21 @@ int init_ctx(ctx_t *pctx, int stack_size, funct_t f, void *args)
void
switch_to_ctx
(
ctx_t
*
pctx
)
void
switch_to_ctx
(
ctx_t
*
pctx
)
{
{
if
(
pctx
->
status
==
CTX_END
)
{
// Si c'est l'unique ctx
if
(
pctx
==
pctx
->
next_ctx
)
ring_ctx
=
NULL
;
else
current_ctx
->
next_ctx
=
pctx
->
next_ctx
;
free
(
pctx
->
stack
);
free
(
pctx
);
yield
();
return
;
}
assert
(
pctx
->
status
!=
CTX_END
);
assert
(
pctx
->
status
!=
CTX_END
);
if
(
current_ctx
!=
NULL
)
if
(
current_ctx
!=
NULL
)
{
{
...
@@ -93,7 +109,13 @@ ctx_t *create_ctx(int stack_size, funct_t f, void *args)
...
@@ -93,7 +109,13 @@ ctx_t *create_ctx(int stack_size, funct_t f, void *args)
void
yield
()
void
yield
()
{
{
assert
(
ring_ctx
!=
NULL
||
current_ctx
!=
NULL
);
//printf("%p, %p\n", current_ctx, ring_ctx);
if
(
ring_ctx
==
NULL
)
{
printf
(
"
\n
End
\n
"
);
exit
(
EXIT_SUCCESS
);
}
if
(
current_ctx
==
NULL
)
if
(
current_ctx
==
NULL
)
switch_to_ctx
(
ring_ctx
->
next_ctx
);
switch_to_ctx
(
ring_ctx
->
next_ctx
);
else
else
...
...
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