Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
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
Jason Beetham
wine
Commits
1f9b4b0a
Commit
1f9b4b0a
authored
24 years ago
by
Ove Kåven
Committed by
Alexandre Julliard
24 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Removed init_sect. Use Interlocked* functions instead.
parent
6889c686
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
scheduler/pthread.c
+10
-17
10 additions, 17 deletions
scheduler/pthread.c
with
10 additions
and
17 deletions
scheduler/pthread.c
+
10
−
17
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
);
...
...
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