Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
637ead21
Commit
637ead21
authored
Feb 25, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(mutex): попытка откорректировать spin_mutex
parent
1da74b3b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
Mutex.h
include/Mutex.h
+3
-5
Mutex.cc
src/Various/Mutex.cc
+2
-2
No files found.
include/Mutex.h
View file @
637ead21
...
...
@@ -28,11 +28,9 @@
#include <omnithread.h>
#include <signal.h>
// -----------------------------------------------------------------------------------------
//#warning Необходимо разобраться с atomic_add и т.п. (и вообще использовать futex-ы)
// -----------------------------------------------------------------------------------------
namespace
UniSetTypes
{
typedef
sig_atomic_t
mutex_atomic_t
;
typedef
volatile
sig_atomic_t
mutex_atomic_t
;
// typedef _Atomic_word mutex_atomic_t;
...
...
@@ -101,7 +99,7 @@ namespace UniSetTypes
uniset_spin_mutex
();
~
uniset_spin_mutex
();
void
lock
(
int
check_pause_msec
=
0
);
void
lock
(
int
check_pause_msec
=
1
);
void
unlock
();
uniset_spin_mutex
(
const
uniset_spin_mutex
&
r
);
...
...
@@ -115,7 +113,7 @@ namespace UniSetTypes
class
uniset_spin_lock
{
public
:
uniset_spin_lock
(
uniset_spin_mutex
&
m
,
int
check_pause_msec
=
0
);
uniset_spin_lock
(
uniset_spin_mutex
&
m
,
int
check_pause_msec
=
1
);
~
uniset_spin_lock
();
private
:
...
...
src/Various/Mutex.cc
View file @
637ead21
...
...
@@ -73,7 +73,7 @@ void uniset_mutex::unlock()
bool
uniset_mutex
::
isRelease
()
{
return
(
bool
)
!
mutex_atomic_read
(
&
locked
);
return
!
(
bool
)
mutex_atomic_read
(
&
locked
);
}
// -----------------------------------------------------------------------------
const
uniset_mutex
&
uniset_mutex
::
operator
=
(
const
uniset_mutex
&
r
)
...
...
@@ -179,7 +179,7 @@ void uniset_spin_mutex::lock( int check_pause_msec )
void
uniset_spin_mutex
::
unlock
()
{
m
=
0
;
m
utex_atomic_set
(
&
m
,
0
)
;
}
// -------------------------------------------------------------------------------------------
uniset_spin_lock
::
uniset_spin_lock
(
uniset_spin_mutex
&
_m
,
int
check_pause_msec
)
:
...
...
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