Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fd499df4
Commit
fd499df4
authored
Mar 12, 2008
by
Dan Hipschman
Committed by
Alexandre Julliard
Mar 13, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qmgr: Add critical sections for jobs and files.
parent
bcfb47e8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
16 deletions
+42
-16
enum_files.c
dlls/qmgr/enum_files.c
+3
-0
file.c
dlls/qmgr/file.c
+8
-2
job.c
dlls/qmgr/job.c
+22
-11
qmgr.c
dlls/qmgr/qmgr.c
+1
-1
qmgr.h
dlls/qmgr/qmgr.h
+8
-2
No files found.
dlls/qmgr/enum_files.c
View file @
fd499df4
...
@@ -186,6 +186,7 @@ HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, IBackgroundCopyJob* iC
...
@@ -186,6 +186,7 @@ HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, IBackgroundCopyJob* iC
/* Create array of files */
/* Create array of files */
This
->
indexFiles
=
0
;
This
->
indexFiles
=
0
;
EnterCriticalSection
(
&
job
->
cs
);
This
->
numFiles
=
list_count
(
&
job
->
files
);
This
->
numFiles
=
list_count
(
&
job
->
files
);
This
->
files
=
NULL
;
This
->
files
=
NULL
;
if
(
This
->
numFiles
>
0
)
if
(
This
->
numFiles
>
0
)
...
@@ -194,6 +195,7 @@ HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, IBackgroundCopyJob* iC
...
@@ -194,6 +195,7 @@ HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, IBackgroundCopyJob* iC
This
->
numFiles
*
sizeof
This
->
files
[
0
]);
This
->
numFiles
*
sizeof
This
->
files
[
0
]);
if
(
!
This
->
files
)
if
(
!
This
->
files
)
{
{
LeaveCriticalSection
(
&
job
->
cs
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
@@ -206,6 +208,7 @@ HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, IBackgroundCopyJob* iC
...
@@ -206,6 +208,7 @@ HRESULT EnumBackgroundCopyFilesConstructor(LPVOID *ppObj, IBackgroundCopyJob* iC
This
->
files
[
i
]
=
(
IBackgroundCopyFile
*
)
file
;
This
->
files
[
i
]
=
(
IBackgroundCopyFile
*
)
file
;
++
i
;
++
i
;
}
}
LeaveCriticalSection
(
&
job
->
cs
);
*
ppObj
=
&
This
->
lpVtbl
;
*
ppObj
=
&
This
->
lpVtbl
;
return
S_OK
;
return
S_OK
;
...
...
dlls/qmgr/file.c
View file @
fd499df4
...
@@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
...
@@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
static
void
BackgroundCopyFileDestructor
(
BackgroundCopyFileImpl
*
This
)
static
void
BackgroundCopyFileDestructor
(
BackgroundCopyFileImpl
*
This
)
{
{
IBackgroundCopyJob_Release
((
IBackgroundCopyJob
*
)
This
->
owner
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
info
.
LocalName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
info
.
LocalName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
info
.
RemoteName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
info
.
RemoteName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
...
@@ -105,9 +106,11 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress(
...
@@ -105,9 +106,11 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress(
{
{
BackgroundCopyFileImpl
*
This
=
(
BackgroundCopyFileImpl
*
)
iface
;
BackgroundCopyFileImpl
*
This
=
(
BackgroundCopyFileImpl
*
)
iface
;
EnterCriticalSection
(
&
This
->
owner
->
cs
);
pVal
->
BytesTotal
=
This
->
fileProgress
.
BytesTotal
;
pVal
->
BytesTotal
=
This
->
fileProgress
.
BytesTotal
;
pVal
->
BytesTransferred
=
This
->
fileProgress
.
BytesTransferred
;
pVal
->
BytesTransferred
=
This
->
fileProgress
.
BytesTransferred
;
pVal
->
Completed
=
This
->
fileProgress
.
Completed
;
pVal
->
Completed
=
This
->
fileProgress
.
Completed
;
LeaveCriticalSection
(
&
This
->
owner
->
cs
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -122,8 +125,9 @@ static const IBackgroundCopyFileVtbl BITS_IBackgroundCopyFile_Vtbl =
...
@@ -122,8 +125,9 @@ static const IBackgroundCopyFileVtbl BITS_IBackgroundCopyFile_Vtbl =
BITS_IBackgroundCopyFile_GetProgress
BITS_IBackgroundCopyFile_GetProgress
};
};
HRESULT
BackgroundCopyFileConstructor
(
LPCWSTR
remoteName
,
HRESULT
BackgroundCopyFileConstructor
(
BackgroundCopyJobImpl
*
owner
,
LPCWSTR
localName
,
LPVOID
*
ppObj
)
LPCWSTR
remoteName
,
LPCWSTR
localName
,
LPVOID
*
ppObj
)
{
{
BackgroundCopyFileImpl
*
This
;
BackgroundCopyFileImpl
*
This
;
int
n
;
int
n
;
...
@@ -160,6 +164,8 @@ HRESULT BackgroundCopyFileConstructor(LPCWSTR remoteName,
...
@@ -160,6 +164,8 @@ HRESULT BackgroundCopyFileConstructor(LPCWSTR remoteName,
This
->
fileProgress
.
BytesTotal
=
BG_SIZE_UNKNOWN
;
This
->
fileProgress
.
BytesTotal
=
BG_SIZE_UNKNOWN
;
This
->
fileProgress
.
BytesTransferred
=
0
;
This
->
fileProgress
.
BytesTransferred
=
0
;
This
->
fileProgress
.
Completed
=
FALSE
;
This
->
fileProgress
.
Completed
=
FALSE
;
This
->
owner
=
owner
;
IBackgroundCopyJob_AddRef
((
IBackgroundCopyJob
*
)
owner
);
*
ppObj
=
&
This
->
lpVtbl
;
*
ppObj
=
&
This
->
lpVtbl
;
return
S_OK
;
return
S_OK
;
...
...
dlls/qmgr/job.c
View file @
fd499df4
...
@@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
...
@@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
static
void
BackgroundCopyJobDestructor
(
BackgroundCopyJobImpl
*
This
)
static
void
BackgroundCopyJobDestructor
(
BackgroundCopyJobImpl
*
This
)
{
{
DeleteCriticalSection
(
&
This
->
cs
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
displayName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
displayName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
}
...
@@ -88,15 +89,17 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFile(
...
@@ -88,15 +89,17 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_AddFile(
/* We should return E_INVALIDARG in these cases. */
/* We should return E_INVALIDARG in these cases. */
FIXME
(
"Check for valid filenames and supported protocols
\n
"
);
FIXME
(
"Check for valid filenames and supported protocols
\n
"
);
res
=
BackgroundCopyFileConstructor
(
RemoteUrl
,
LocalName
,
(
LPVOID
*
)
&
pFile
);
res
=
BackgroundCopyFileConstructor
(
This
,
RemoteUrl
,
LocalName
,
(
LPVOID
*
)
&
pFile
);
if
(
res
!=
S_OK
)
if
(
res
!=
S_OK
)
return
res
;
return
res
;
/* Add a reference to the file to file list */
/* Add a reference to the file to file list */
IBackgroundCopyFile_AddRef
(
pFile
);
IBackgroundCopyFile_AddRef
(
pFile
);
file
=
(
BackgroundCopyFileImpl
*
)
pFile
;
file
=
(
BackgroundCopyFileImpl
*
)
pFile
;
EnterCriticalSection
(
&
This
->
cs
);
list_add_head
(
&
This
->
files
,
&
file
->
entryFromJob
);
list_add_head
(
&
This
->
files
,
&
file
->
entryFromJob
);
++
This
->
jobProgress
.
FilesTotal
;
++
This
->
jobProgress
.
FilesTotal
;
LeaveCriticalSection
(
&
This
->
cs
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -120,24 +123,26 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_Resume(
...
@@ -120,24 +123,26 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_Resume(
IBackgroundCopyJob
*
iface
)
IBackgroundCopyJob
*
iface
)
{
{
BackgroundCopyJobImpl
*
This
=
(
BackgroundCopyJobImpl
*
)
iface
;
BackgroundCopyJobImpl
*
This
=
(
BackgroundCopyJobImpl
*
)
iface
;
HRESULT
rv
=
S_OK
;
EnterCriticalSection
(
&
globalMgr
.
cs
);
if
(
This
->
state
==
BG_JOB_STATE_CANCELLED
if
(
This
->
state
==
BG_JOB_STATE_CANCELLED
||
This
->
state
==
BG_JOB_STATE_ACKNOWLEDGED
)
||
This
->
state
==
BG_JOB_STATE_ACKNOWLEDGED
)
{
{
r
eturn
BG_E_INVALID_STATE
;
r
v
=
BG_E_INVALID_STATE
;
}
}
else
if
(
This
->
jobProgress
.
FilesTransferred
==
This
->
jobProgress
.
FilesTotal
)
if
(
This
->
jobProgress
.
FilesTransferred
==
This
->
jobProgress
.
FilesTotal
)
return
BG_E_EMPTY
;
if
(
This
->
state
==
BG_JOB_STATE_CONNECTING
||
This
->
state
==
BG_JOB_STATE_TRANSFERRING
)
{
{
r
eturn
S_OK
;
r
v
=
BG_E_EMPTY
;
}
}
else
if
(
This
->
state
!=
BG_JOB_STATE_CONNECTING
&&
This
->
state
!=
BG_JOB_STATE_TRANSFERRING
)
{
This
->
state
=
BG_JOB_STATE_QUEUED
;
This
->
state
=
BG_JOB_STATE_QUEUED
;
return
S_OK
;
}
LeaveCriticalSection
(
&
globalMgr
.
cs
);
return
rv
;
}
}
static
HRESULT
WINAPI
BITS_IBackgroundCopyJob_Cancel
(
static
HRESULT
WINAPI
BITS_IBackgroundCopyJob_Cancel
(
...
@@ -185,10 +190,12 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProgress(
...
@@ -185,10 +190,12 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProgress(
if
(
!
pVal
)
if
(
!
pVal
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
EnterCriticalSection
(
&
This
->
cs
);
pVal
->
BytesTotal
=
This
->
jobProgress
.
BytesTotal
;
pVal
->
BytesTotal
=
This
->
jobProgress
.
BytesTotal
;
pVal
->
BytesTransferred
=
This
->
jobProgress
.
BytesTransferred
;
pVal
->
BytesTransferred
=
This
->
jobProgress
.
BytesTransferred
;
pVal
->
FilesTotal
=
This
->
jobProgress
.
FilesTotal
;
pVal
->
FilesTotal
=
This
->
jobProgress
.
FilesTotal
;
pVal
->
FilesTransferred
=
This
->
jobProgress
.
FilesTransferred
;
pVal
->
FilesTransferred
=
This
->
jobProgress
.
FilesTransferred
;
LeaveCriticalSection
(
&
This
->
cs
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -210,6 +217,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetState(
...
@@ -210,6 +217,7 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetState(
if
(
!
pVal
)
if
(
!
pVal
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
/* Don't think we need a critical section for this */
*
pVal
=
This
->
state
;
*
pVal
=
This
->
state
;
return
S_OK
;
return
S_OK
;
}
}
...
@@ -441,6 +449,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
...
@@ -441,6 +449,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
This
->
lpVtbl
=
&
BITS_IBackgroundCopyJob_Vtbl
;
This
->
lpVtbl
=
&
BITS_IBackgroundCopyJob_Vtbl
;
InitializeCriticalSection
(
&
This
->
cs
);
This
->
ref
=
1
;
This
->
ref
=
1
;
This
->
type
=
type
;
This
->
type
=
type
;
...
@@ -448,6 +457,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
...
@@ -448,6 +457,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
This
->
displayName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
n
);
This
->
displayName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
n
);
if
(
!
This
->
displayName
)
if
(
!
This
->
displayName
)
{
{
DeleteCriticalSection
(
&
This
->
cs
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
@@ -456,6 +466,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
...
@@ -456,6 +466,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
hr
=
CoCreateGuid
(
&
This
->
jobId
);
hr
=
CoCreateGuid
(
&
This
->
jobId
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
DeleteCriticalSection
(
&
This
->
cs
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
displayName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
displayName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
hr
;
return
hr
;
...
...
dlls/qmgr/qmgr.c
View file @
fd499df4
...
@@ -127,7 +127,7 @@ static const IBackgroundCopyManagerVtbl BITS_IBackgroundCopyManager_Vtbl =
...
@@ -127,7 +127,7 @@ static const IBackgroundCopyManagerVtbl BITS_IBackgroundCopyManager_Vtbl =
BITS_IBackgroundCopyManager_GetErrorDescription
BITS_IBackgroundCopyManager_GetErrorDescription
};
};
static
BackgroundCopyManagerImpl
globalMgr
=
{
BackgroundCopyManagerImpl
globalMgr
=
{
&
BITS_IBackgroundCopyManager_Vtbl
,
&
BITS_IBackgroundCopyManager_Vtbl
,
{
NULL
,
-
1
,
0
,
0
,
0
,
0
},
{
NULL
,
-
1
,
0
,
0
,
0
,
0
},
LIST_INIT
(
globalMgr
.
jobs
)
LIST_INIT
(
globalMgr
.
jobs
)
...
...
dlls/qmgr/qmgr.h
View file @
fd499df4
...
@@ -41,6 +41,8 @@ typedef struct
...
@@ -41,6 +41,8 @@ typedef struct
struct
list
files
;
struct
list
files
;
BG_JOB_PROGRESS
jobProgress
;
BG_JOB_PROGRESS
jobProgress
;
BG_JOB_STATE
state
;
BG_JOB_STATE
state
;
/* Protects file list, and progress */
CRITICAL_SECTION
cs
;
struct
list
entryFromQmgr
;
struct
list
entryFromQmgr
;
}
BackgroundCopyJobImpl
;
}
BackgroundCopyJobImpl
;
...
@@ -72,12 +74,14 @@ typedef struct
...
@@ -72,12 +74,14 @@ typedef struct
BG_FILE_INFO
info
;
BG_FILE_INFO
info
;
BG_FILE_PROGRESS
fileProgress
;
BG_FILE_PROGRESS
fileProgress
;
struct
list
entryFromJob
;
struct
list
entryFromJob
;
BackgroundCopyJobImpl
*
owner
;
}
BackgroundCopyFileImpl
;
}
BackgroundCopyFileImpl
;
/* Background copy manager vtbl and related data */
/* Background copy manager vtbl and related data */
typedef
struct
typedef
struct
{
{
const
IBackgroundCopyManagerVtbl
*
lpVtbl
;
const
IBackgroundCopyManagerVtbl
*
lpVtbl
;
/* Protects job list and job states */
CRITICAL_SECTION
cs
;
CRITICAL_SECTION
cs
;
struct
list
jobs
;
struct
list
jobs
;
}
BackgroundCopyManagerImpl
;
}
BackgroundCopyManagerImpl
;
...
@@ -88,14 +92,16 @@ typedef struct
...
@@ -88,14 +92,16 @@ typedef struct
}
ClassFactoryImpl
;
}
ClassFactoryImpl
;
extern
ClassFactoryImpl
BITS_ClassFactory
;
extern
ClassFactoryImpl
BITS_ClassFactory
;
extern
BackgroundCopyManagerImpl
globalMgr
;
HRESULT
BackgroundCopyManagerConstructor
(
IUnknown
*
pUnkOuter
,
LPVOID
*
ppObj
);
HRESULT
BackgroundCopyManagerConstructor
(
IUnknown
*
pUnkOuter
,
LPVOID
*
ppObj
);
HRESULT
BackgroundCopyJobConstructor
(
LPCWSTR
displayName
,
BG_JOB_TYPE
type
,
HRESULT
BackgroundCopyJobConstructor
(
LPCWSTR
displayName
,
BG_JOB_TYPE
type
,
GUID
*
pJobId
,
LPVOID
*
ppObj
);
GUID
*
pJobId
,
LPVOID
*
ppObj
);
HRESULT
EnumBackgroundCopyJobsConstructor
(
LPVOID
*
ppObj
,
HRESULT
EnumBackgroundCopyJobsConstructor
(
LPVOID
*
ppObj
,
IBackgroundCopyManager
*
copyManager
);
IBackgroundCopyManager
*
copyManager
);
HRESULT
BackgroundCopyFileConstructor
(
LPCWSTR
remoteName
,
HRESULT
BackgroundCopyFileConstructor
(
BackgroundCopyJobImpl
*
owner
,
LPCWSTR
localName
,
LPVOID
*
ppObj
);
LPCWSTR
remoteName
,
LPCWSTR
localName
,
LPVOID
*
ppObj
);
HRESULT
EnumBackgroundCopyFilesConstructor
(
LPVOID
*
ppObj
,
HRESULT
EnumBackgroundCopyFilesConstructor
(
LPVOID
*
ppObj
,
IBackgroundCopyJob
*
copyJob
);
IBackgroundCopyJob
*
copyJob
);
...
...
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