Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
2e82e70f
Commit
2e82e70f
authored
Nov 26, 2014
by
Adeel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Importer: Uses uv_cond to solve the puzzle.
Credit goes to @txdv.
parent
b2ce0f6f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
18 deletions
+7
-18
binding.cpp
src/binding.cpp
+2
-12
libsass
src/libsass
+1
-1
sass_context_wrapper.cpp
src/sass_context_wrapper.cpp
+2
-2
sass_context_wrapper.h
src/sass_context_wrapper.h
+2
-3
No files found.
src/binding.cpp
View file @
2e82e70f
...
...
@@ -55,8 +55,7 @@ void dispatched_async_uv_callback(uv_async_t *req){
ctx_w
->
imports
[
0
]
=
sass_make_import_entry
(
ctx_w
->
file
,
0
,
0
);
}
//uv_mutex_unlock(ctx_w->mutex);
ctx_w
->
importer_mutex
->
unlock
();
uv_cond_signal
(
&
ctx_w
->
importer_condition_variable
);
if
(
try_catch
.
HasCaught
())
{
node
::
FatalException
(
try_catch
);
...
...
@@ -67,20 +66,11 @@ struct Sass_Import** sass_importer(const char* file, void* cookie)
{
sass_context_wrapper
*
ctx_w
=
static_cast
<
sass_context_wrapper
*>
(
cookie
);
ctx_w
->
importer_mutex
->
lock
();
//uv_mutex_lock(ctx_w->mutex);
// Enter critical section
ctx_w
->
file
=
strdup
(
file
);
ctx_w
->
async
.
data
=
(
void
*
)
ctx_w
;
uv_async_send
(
&
ctx_w
->
async
);
// Reassurances
//uv_mutex_lock(ctx_w->mutex);
//uv_mutex_unlock(ctx_w->mutex);
Sleep
(
5
);
ctx_w
->
importer_mutex
->
lock
();
ctx_w
->
importer_mutex
->
unlock
();
uv_cond_wait
(
&
ctx_w
->
importer_condition_variable
,
&
ctx_w
->
importer_mutex
);
return
ctx_w
->
imports
;
}
...
...
libsass
@
a94377b5
Subproject commit
21688e1979bff089a13d9a44ad0608357b2a91cc
Subproject commit
a94377b5aac6a10a6aa3ed90656557e7b9843fd1
src/sass_context_wrapper.cpp
View file @
2e82e70f
...
...
@@ -23,9 +23,9 @@ extern "C" {
}
sass_context_wrapper
*
sass_make_context_wrapper
()
{
// (sass_context_wrapper*) calloc(1, sizeof(sass_context_wrapper));
auto
ctx_w
=
(
sass_context_wrapper
*
)
calloc
(
1
,
sizeof
(
sass_context_wrapper
));
ctx_w
->
importer_mutex
=
new
std
::
mutex
();
uv_mutex_init
(
&
ctx_w
->
importer_mutex
);
uv_cond_init
(
&
ctx_w
->
importer_condition_variable
);
return
ctx_w
;
}
...
...
src/sass_context_wrapper.h
View file @
2e82e70f
#include <mutex>
#include <nan.h>
#include "libsass/sass_context.h"
...
...
@@ -17,8 +16,8 @@ extern "C" {
Sass_File_Context
*
fctx
;
Persistent
<
Object
>
stats
;
uv_work_t
request
;
std
::
mutex
*
importer_mutex
;
//uv_mutex_t* mutex
;
uv_mutex_t
importer_mutex
;
uv_cond_t
importer_condition_variable
;
uv_async_t
async
;
const
char
*
file
;
void
*
cookie
;
...
...
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