Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Environments
Terraform modules
Monitor
Incidents
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
Main
Synchronet
Commits
ddd04b29
Commit
ddd04b29
authored
19 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
file_mutex() now supports an option max_age argument (to detect and remove
stale mutex files).
parent
149e73aa
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/js_global.c
+14
-7
14 additions, 7 deletions
src/sbbs3/js_global.c
with
14 additions
and
7 deletions
src/sbbs3/js_global.c
+
14
−
7
View file @
ddd04b29
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
5
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
6
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
...
...
@@ -2241,16 +2241,20 @@ js_fmutex(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
char
*
fname
;
char
*
text
=
NULL
;
int32
max_age
=
0
;
uintN
argn
=
0
;
if
(
JSVAL_IS_VOID
(
argv
[
0
]))
return
(
JS_TRUE
);
if
((
fname
=
js_ValueToStringBytes
(
cx
,
argv
[
0
],
NULL
))
==
NULL
)
if
((
fname
=
js_ValueToStringBytes
(
cx
,
argv
[
argn
++
],
NULL
))
==
NULL
)
return
(
JS_FALSE
);
if
(
argc
>
1
)
text
=
js_ValueToStringBytes
(
cx
,
argv
[
1
],
NULL
);
if
(
argc
>
argn
&&
JSVAL_IS_STRING
(
argv
[
argn
]))
text
=
js_ValueToStringBytes
(
cx
,
argv
[
argn
++
],
NULL
);
if
(
argc
>
argn
&&
JSVAL_IS_NUMBER
(
argv
[
argn
]))
JS_ValueToInt32
(
cx
,
argv
[
argn
++
],
&
max_age
);
*
rval
=
BOOLEAN_TO_JSVAL
(
fmutex
(
fname
,
text
));
*
rval
=
BOOLEAN_TO_JSVAL
(
fmutex
(
fname
,
text
,
max_age
));
return
(
JS_TRUE
);
}
...
...
@@ -2765,9 +2769,12 @@ static jsSyncMethodSpec js_global_functions[] = {
"creating an empty file if it doesn't already exist"
)
,
311
},
{
"file_mutex"
,
js_fmutex
,
1
,
JSTYPE_BOOLEAN
,
JSDOCSTR
(
"string filename [,
text
]"
)
{
"file_mutex"
,
js_fmutex
,
1
,
JSTYPE_BOOLEAN
,
JSDOCSTR
(
"string filename [,
string text] [,number max_age
]"
)
,
JSDOCSTR
(
"attempts to create an exclusive (e.g. lock) file, "
"optionally with the contents of <i>text</i>"
)
"optionally with the contents of <i>text</i>. "
"If a non-zero <i>max_age</i> (supported in v3.13b+) is specified "
"and the lock file exists, but is older than this value (in seconds), "
"it is presumed stale and removed/over-written"
)
,
312
},
{
"directory"
,
js_directory
,
1
,
JSTYPE_ARRAY
,
JSDOCSTR
(
"string pattern [,flags]"
)
...
...
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