Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
f4grx
NuttX RTOS
Commits
3f8a084d
Commit
3f8a084d
authored
9 years ago
by
- Max Neklyudov
Committed by
Gregory Nutt
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fs/vfs/fs_poll.c: use sem_tickwait instead of sem_timedwait
parent
7d0f9436
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fs/vfs/fs_poll.c
+7
-30
7 additions, 30 deletions
fs/vfs/fs_poll.c
with
7 additions
and
30 deletions
fs/vfs/fs_poll.c
+
7
−
30
View file @
3f8a084d
/****************************************************************************
* fs/vfs/fs_poll.c
*
* Copyright (C) 2008-2009, 2012-201
4
Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2012-201
5
Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
...
...
@@ -39,16 +39,16 @@
#include
<nuttx/config.h>
#include
<stdint.h>
#include
<stdbool.h>
#include
<poll.h>
#include
<errno.h>
#include
<time.h>
#include
<semaphore.h>
#include
<assert.h>
#include
<
debug
.h>
#include
<
errno
.h>
#include
<nuttx/sched.h>
#include
<nuttx/clock.h>
#include
<nuttx/fs/fs.h>
#include
<nuttx/net/net.h>
#include
<arch/irq.h>
...
...
@@ -341,36 +341,15 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
}
else
if
(
timeout
>
0
)
{
time_t
sec
;
uint32_t
nsec
;
/* Either wait for either a poll event(s), for a signal to occur,
* or for the specified timeout to elapse with no event.
*
* NOTE: If a poll event is pending (i.e., the semaphore has already
* been incremented), sem_ti
med
wait() will not wait, but will return
* been incremented), sem_ti
ck
wait() will not wait, but will return
* immediately.
*/
sec
=
timeout
/
MSEC_PER_SEC
;
nsec
=
(
timeout
-
MSEC_PER_SEC
*
sec
)
*
NSEC_PER_MSEC
;
/* Make sure that the following are atomic by disabling interrupts.
* Interrupts will be re-enabled while we are waiting.
*/
flags
=
irqsave
();
(
void
)
clock_gettime
(
CLOCK_REALTIME
,
&
abstime
);
abstime
.
tv_sec
+=
sec
;
abstime
.
tv_nsec
+=
nsec
;
if
(
abstime
.
tv_nsec
>=
NSEC_PER_SEC
)
{
abstime
.
tv_sec
++
;
abstime
.
tv_nsec
-=
NSEC_PER_SEC
;
}
ret
=
sem_timedwait
(
&
sem
,
&
abstime
);
ret
=
sem_tickwait
(
&
sem
,
clock_systimer
(),
MSEC2TICK
(
timeout
));
if
(
ret
<
0
)
{
int
err
=
get_errno
();
...
...
@@ -388,8 +367,6 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
ret
=
-
err
;
}
}
irqrestore
(
flags
);
}
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