Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
6daf1820
Commit
6daf1820
authored
Aug 06, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32/WinCE: always use our internal wait wrapper
parent
d1cf0636
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
49 deletions
+43
-49
src/win32/thread.c
src/win32/thread.c
+43
-49
No files found.
src/win32/thread.c
View file @
6daf1820
...
...
@@ -61,42 +61,6 @@ struct vlc_thread
void
*
data
;
};
#ifdef UNDER_CE
static
void
CALLBACK
vlc_cancel_self
(
ULONG_PTR
dummy
);
DWORD
WaitForMultipleObjectsEx
(
DWORD
nCount
,
const
HANDLE
*
lpHandles
,
BOOL
bWaitAll
,
DWORD
dwMilliseconds
,
BOOL
bAlertable
)
{
struct
vlc_thread
*
th
=
vlc_threadvar_get
(
thread_key
);
HANDLE
handles
[
nCount
+
1
];
DWORD
ret
;
memcpy
(
handles
,
lpHandles
,
nCount
*
sizeof
(
HANDLE
));
if
(
bAlertable
)
{
if
(
th
!=
NULL
)
{
handles
[
nCount
]
=
th
->
cancel_event
;
/* bWaitAll not implemented and not used by VLC... */
assert
(
!
bWaitAll
);
}
else
bAlertable
=
FALSE
;
}
ret
=
WaitForMultipleObjects
(
nCount
+
bAlertable
,
handles
,
bWaitAll
,
dwMilliseconds
);
if
(
ret
==
WAIT_OBJECT_0
+
nCount
)
{
assert
(
bAlertable
);
vlc_cancel_self
((
uintptr_t
)
th
);
ret
=
WAIT_IO_COMPLETION
;
}
return
ret
;
}
#endif
static
vlc_mutex_t
super_mutex
;
static
vlc_cond_t
super_variable
;
...
...
@@ -124,17 +88,51 @@ BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
return
TRUE
;
}
static
void
CALLBACK
vlc_cancel_self
(
ULONG_PTR
);
static
DWORD
vlc_WaitForMultipleObjects
(
DWORD
count
,
const
HANDLE
*
handles
,
DWORD
delay
)
{
DWORD
ret
=
WaitForMultipleObjectsEx
(
count
,
handles
,
FALSE
,
delay
,
TRUE
);
DWORD
ret
;
#ifdef UNDER_CE
HANDLE
buf
[
count
+
1
];
struct
vlc_thread
*
th
=
vlc_threadvar_get
(
thread_key
);
if
(
th
!=
NULL
)
{
memcpy
(
buf
,
handles
,
count
*
sizeof
(
HANDLE
));
buf
[
count
++
]
=
th
->
cancel_event
;
handles
=
buf
;
}
if
(
count
==
0
)
{
Sleep
(
delay
);
ret
=
WAIT_TIMEOUT
;
}
else
ret
=
WaitForMultipleObjects
(
count
,
handles
,
FALSE
,
delay
);
if
((
th
!=
NULL
)
&&
(
ret
==
WAIT_OBJECT_0
+
count
-
1
))
{
vlc_cancel_self
((
uintptr_t
)
th
);
ret
=
WAIT_IO_COMPLETION
;
}
#else
if
(
count
==
0
)
{
ret
=
SleepEx
(
delay
,
TRUE
);
if
(
ret
==
0
)
ret
=
WAIT_TIMEOUT
;
}
else
ret
=
WaitForMultipleObjectsEx
(
count
,
handles
,
FALSE
,
delay
,
TRUE
);
#endif
/* We do not abandon objects... this would be a bug */
assert
(
ret
<
WAIT_ABANDONED_0
||
WAIT_ABANDONED_0
+
count
-
1
<
ret
);
if
(
unlikely
(
ret
==
WAIT_FAILED
))
abort
();
/* We are screwed! */
return
ret
;
}
...
...
@@ -143,15 +141,11 @@ static DWORD vlc_WaitForSingleObject (HANDLE handle, DWORD delay)
return
vlc_WaitForMultipleObjects
(
1
,
&
handle
,
delay
);
}
#if 0 // WaitForMultipleObjectsEx() cannot deal with zero handles
static
DWORD
vlc_Sleep
(
DWORD
delay
)
{
DWORD
ret
=
vlc_WaitForMultipleObjects
(
0
,
NULL
,
delay
);
if (ret == WAIT_TIMEOUT)
ret = 0;
return ret;
return
(
ret
!=
WAIT_TIMEOUT
)
?
ret
:
0
;
}
#endif
/*** Mutexes ***/
...
...
@@ -638,7 +632,7 @@ void vlc_join (vlc_thread_t th, void **result)
{
do
vlc_testcancel
();
while
(
WaitForSingleObjectEx
(
th
->
id
,
INFINITE
,
TRU
E
)
while
(
vlc_WaitForSingleObject
(
th
->
id
,
INFINIT
E
)
==
WAIT_IO_COMPLETION
);
if
(
result
!=
NULL
)
...
...
@@ -791,7 +785,7 @@ void mwait (mtime_t deadline)
delay
/=
1000
;
if
(
unlikely
(
delay
>
0x7fffffff
))
delay
=
0x7fffffff
;
SleepEx
(
delay
,
TRUE
);
vlc_Sleep
(
delay
);
vlc_testcancel
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment