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
1f9b4b0a
Commit
1f9b4b0a
authored
Apr 28, 2000
by
Ove Kaaven
Committed by
Alexandre Julliard
Apr 28, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed init_sect. Use Interlocked* functions instead.
parent
6889c686
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
17 deletions
+10
-17
pthread.c
scheduler/pthread.c
+10
-17
No files found.
scheduler/pthread.c
View file @
1f9b4b0a
...
...
@@ -79,8 +79,6 @@ typedef const void *key_data;
#define FIRST_KEY 0
#define MAX_KEYS 16
/* libc6 doesn't use that many, but... */
static
CRITICAL_SECTION
init_sect
=
CRITICAL_SECTION_INIT
;
#define P_OUTPUT(stuff) write(2,stuff,strlen(stuff))
void
__pthread_initialize
(
void
)
...
...
@@ -90,13 +88,10 @@ void __pthread_initialize(void)
int
__pthread_once
(
pthread_once_t
*
once_control
,
void
(
*
init_routine
)(
void
))
{
static
pthread_once_t
the_once
=
PTHREAD_ONCE_INIT
;
LONG
once_now
=
*
(
LONG
*
)
&
the_once
;
EnterCriticalSection
(
&
init_sect
);
if
(
!
memcmp
(
once_control
,
&
the_once
,
sizeof
(
the_once
)))
{
if
(
InterlockedCompareExchange
((
PVOID
*
)
once_control
,
(
PVOID
)(
once_now
+
1
),
(
PVOID
)
once_now
)
==
(
PVOID
)
once_now
)
(
*
init_routine
)();
(
*
(
int
*
)
once_control
)
++
;
}
LeaveCriticalSection
(
&
init_sect
);
return
0
;
}
strong_alias
(
__pthread_once
,
pthread_once
);
...
...
@@ -151,14 +146,14 @@ strong_alias(__pthread_mutex_init, pthread_mutex_init);
static
void
mutex_real_init
(
pthread_mutex_t
*
mutex
)
{
EnterCriticalSection
(
&
init_sect
);
CRITICAL_SECTION
*
critsect
=
HeapAlloc
(
SystemHeap
,
0
,
sizeof
(
CRITICAL_SECTION
));
InitializeCriticalSection
(
critsect
);
if
(
!
((
wine_mutex
)
mutex
)
->
critsect
)
{
((
wine_mutex
)
mutex
)
->
critsect
=
HeapAlloc
(
SystemHeap
,
0
,
sizeof
(
CRITICAL_SECTION
));
InitializeCriticalSection
(((
wine_mutex
)
mutex
)
->
critsect
);
if
(
InterlockedCompareExchange
((
PVOID
*
)
&
(((
wine_mutex
)
mutex
)
->
critsect
),
critsect
,
NULL
)
!=
NULL
)
{
/* too late, some other thread already did it */
DeleteCriticalSection
(
critsect
);
HeapFree
(
SystemHeap
,
0
,
critsect
);
}
LeaveCriticalSection
(
&
init_sect
);
}
int
__pthread_mutex_lock
(
pthread_mutex_t
*
mutex
)
...
...
@@ -258,10 +253,8 @@ strong_alias(__pthread_mutexattr_gettype, pthread_mutexattr_gettype);
int
__pthread_key_create
(
pthread_key_t
*
key
,
void
(
*
destr_function
)(
void
*
))
{
static
pthread_key_t
keycnt
=
FIRST_KEY
;
EnterCriticalSection
(
&
init_sect
);
*
key
=
keycnt
++
;
LeaveCriticalSection
(
&
init_sect
);
static
LONG
keycnt
=
FIRST_KEY
;
*
key
=
InterlockedExchangeAdd
(
&
keycnt
,
1
);
return
0
;
}
strong_alias
(
__pthread_key_create
,
pthread_key_create
);
...
...
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