Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
liboop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Magnus Holmgren
liboop
Commits
24e1eb0b
Commit
24e1eb0b
authored
24 years ago
by
Dan Egnor
Browse files
Options
Downloads
Patches
Plain Diff
oops oops oops
parent
16995d9e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sys.c
+19
-13
19 additions, 13 deletions
sys.c
with
19 additions
and
13 deletions
sys.c
+
19
−
13
View file @
24e1eb0b
...
...
@@ -263,8 +263,8 @@ oop_source_sys *oop_sys_new(void) {
}
static
void
*
sys_time_run
(
oop_source_sys
*
sys
)
{
void
*
ret
=
NULL
;
while
(
NULL
==
ret
&&
NULL
!=
sys
->
time_run
)
{
void
*
ret
=
OOP_CONTINUE
;
while
(
OOP_CONTINUE
==
ret
&&
NULL
!=
sys
->
time_run
)
{
struct
sys_time
*
p
=
sys
->
time_run
;
sys
->
time_run
=
sys
->
time_run
->
next
;
--
sys
->
num_events
;
...
...
@@ -275,14 +275,14 @@ static void *sys_time_run(oop_source_sys *sys) {
}
void
*
oop_sys_run
(
oop_source_sys
*
sys
)
{
void
*
volatile
ret
=
NULL
;
void
*
volatile
ret
=
OOP_CONTINUE
;
assert
(
!
sys
->
in_run
&&
"oop_sys_run is not reentrant"
);
sys
->
in_run
=
1
;
while
(
0
!=
sys
->
num_events
&&
NULL
==
ret
)
{
while
(
0
!=
sys
->
num_events
&&
OOP_CONTINUE
==
ret
)
{
struct
timeval
*
volatile
ptv
=
NULL
;
struct
timeval
tv
;
fd_set
rfd
,
wfd
;
fd_set
rfd
,
wfd
,
xfd
;
int
i
,
rv
;
if
(
NULL
!=
sys
->
time_run
)
{
...
...
@@ -315,13 +315,15 @@ void *oop_sys_run(oop_source_sys *sys) {
FD_ZERO
(
&
rfd
);
FD_ZERO
(
&
wfd
);
FD_ZERO
(
&
xfd
);
for
(
i
=
0
;
i
<
sys
->
num_files
;
++
i
)
{
if
(
NULL
!=
sys
->
files
[
i
][
OOP_READ
].
f
)
FD_SET
(
i
,
&
rfd
);
if
(
NULL
!=
sys
->
files
[
i
][
OOP_WRITE
].
f
)
FD_SET
(
i
,
&
wfd
);
if
(
NULL
!=
sys
->
files
[
i
][
OOP_EXCEPTION
].
f
)
FD_SET
(
i
,
&
xfd
);
}
do
rv
=
select
(
sys
->
num_files
,
&
rfd
,
&
wfd
,
NULL
,
ptv
);
rv
=
select
(
sys
->
num_files
,
&
rfd
,
&
wfd
,
&
xfd
,
ptv
);
while
(
0
>
rv
&&
EINTR
==
errno
);
sys
->
do_jmp
=
0
;
...
...
@@ -330,39 +332,43 @@ void *oop_sys_run(oop_source_sys *sys) {
if
(
sys
->
sig_active
)
{
sys
->
sig_active
=
0
;
for
(
i
=
0
;
NULL
==
ret
&&
i
<
OOP_NUM_SIGNALS
;
++
i
)
{
for
(
i
=
0
;
OOP_CONTINUE
==
ret
&&
i
<
OOP_NUM_SIGNALS
;
++
i
)
{
if
(
sys
->
sig
[
i
].
active
)
{
sys
->
sig
[
i
].
active
=
0
;
sys
->
sig
[
i
].
ptr
=
sys
->
sig
[
i
].
list
;
}
while
(
NULL
==
ret
&&
NULL
!=
sys
->
sig
[
i
].
ptr
)
{
while
(
OOP_CONTINUE
==
ret
&&
NULL
!=
sys
->
sig
[
i
].
ptr
)
{
struct
sys_signal_handler
*
h
;
h
=
sys
->
sig
[
i
].
ptr
;
sys
->
sig
[
i
].
ptr
=
h
->
next
;
ret
=
h
->
f
(
&
sys
->
oop
,
i
,
h
->
v
);
}
}
if
(
NULL
!=
ret
)
{
if
(
OOP_CONTINUE
!=
ret
)
{
sys
->
sig_active
=
1
;
/* come back */
break
;
}
}
if
(
0
<
rv
)
{
for
(
i
=
0
;
i
<
sys
->
num_files
&&
NULL
==
ret
;
++
i
)
for
(
i
=
0
;
i
<
sys
->
num_files
&&
OOP_CONTINUE
==
ret
;
++
i
)
if
(
FD_ISSET
(
i
,
&
xfd
)
&&
NULL
!=
sys
->
files
[
i
][
OOP_EXCEPTION
].
f
)
ret
=
sys
->
files
[
i
][
OOP_EXCEPTION
].
f
(
&
sys
->
oop
,
i
,
OOP_EXCEPTION
,
sys
->
files
[
i
][
OOP_EXCEPTION
].
v
);
for
(
i
=
0
;
i
<
sys
->
num_files
&&
OOP_CONTINUE
==
ret
;
++
i
)
if
(
FD_ISSET
(
i
,
&
wfd
)
&&
NULL
!=
sys
->
files
[
i
][
OOP_WRITE
].
f
)
ret
=
sys
->
files
[
i
][
OOP_WRITE
].
f
(
&
sys
->
oop
,
i
,
OOP_WRITE
,
sys
->
files
[
i
][
OOP_WRITE
].
v
);
for
(
i
=
0
;
i
<
sys
->
num_files
&&
NULL
==
ret
;
++
i
)
for
(
i
=
0
;
i
<
sys
->
num_files
&&
OOP_CONTINUE
==
ret
;
++
i
)
if
(
FD_ISSET
(
i
,
&
rfd
)
&&
NULL
!=
sys
->
files
[
i
][
OOP_READ
].
f
)
ret
=
sys
->
files
[
i
][
OOP_READ
].
f
(
&
sys
->
oop
,
i
,
OOP_READ
,
sys
->
files
[
i
][
OOP_READ
].
v
);
if
(
NULL
!=
ret
)
break
;
if
(
OOP_CONTINUE
!=
ret
)
break
;
}
/* Catch any leftover timeout events. */
ret
=
sys_time_run
(
sys
);
if
(
NULL
!=
ret
)
break
;
if
(
OOP_CONTINUE
!=
ret
)
break
;
if
(
NULL
!=
sys
->
time_queue
)
{
struct
sys_time
*
p
,
**
pp
=
&
sys
->
time_queue
;
...
...
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