App Engine Channel API的线程安全性/原子性(Thread safety / atomicity of App Engine Channel API)
当我尝试使用Google App Engine的Channel API发送消息但是来自两个或更多goroutine和/或任务队列时会发生什么? 例如
go channel.Send(context, clientID, "Hello") go channel.Send(context, clientID, "World")
据我所知,在GAE Go中,所有goroutine都被复用到一个线程上。 但是,这仍然允许在I / O期间进行抢占,并且可能通道发送符合I / O的条件。
GAE开发服务器似乎序列化所有请求,因此我没有看到任何通道发送重叠。 生产服务器似乎允许一些请求并发,但是通道发送看起来是原子的,或者至少可以安全地从不同的线程/ goroutine调用。
What happens when I try to send a message with Google App Engine's Channel API but from two or more goroutines and/or task queues? e.g.
go channel.Send(context, clientID, "Hello") go channel.Send(context, clientID, "World")
I understand that in GAE Go, all goroutines are multiplexed onto a single thread. However this still allows for pre-emption during I/O, and presumably channel sends qualify as I/O.
The GAE dev server seems to serialize all requests so I don't see any channel sends overlapping. The production server seems to allow some request concurrency but the channel sends appear atomic or at least safe to call from different threads/goroutines.
原文:https://stackoverflow.com/questions/18674252
最满意答案
正如@pjumble评论所述,您只是定义变量。 获取代码并添加额外的
hello_world
语句:$font-size: 16px; $em: $font-size / 1em; $column: 48px; $gutter: 24px; $cols1: ( 1 * ($column + $gutter) - $gutter) / $em; $cols2: ( 2 * ($column + $gutter) - $gutter) / $em; $cols3: ( 3 * ($column + $gutter) - $gutter) / $em; $cols4: ( 4 * ($column + $gutter) - $gutter) / $em; $cols5: ( 5 * ($column + $gutter) - $gutter) / $em; $cols6: ( 6 * ($column + $gutter) - $gutter) / $em; $cols7: ( 7 * ($column + $gutter) - $gutter) / $em; $cols8: ( 8 * ($column + $gutter) - $gutter) / $em; $cols9: ( 9 * ($column + $gutter) - $gutter) / $em; $cols10: (10 * ($column + $gutter) - $gutter) / $em; $cols11: (11 * ($column + $gutter) - $gutter) / $em; $cols12: (12 * ($column + $gutter) - $gutter) / $em; $cols13: (13 * ($column + $gutter) - $gutter) / $em; $cols14: (14 * ($column + $gutter) - $gutter) / $em; $cols15: (15 * ($column + $gutter) - $gutter) / $em; $cols16: (16 * ($column + $gutter) - $gutter) / $em; .hello_world{ width: $column }
命令
sass grid.scss grid.css
生成:.hello_world { width: 48px; }
As stated by @pjumble comment, you are only defining variables. Taking your code and adding the additional
hello_world
statement:$font-size: 16px; $em: $font-size / 1em; $column: 48px; $gutter: 24px; $cols1: ( 1 * ($column + $gutter) - $gutter) / $em; $cols2: ( 2 * ($column + $gutter) - $gutter) / $em; $cols3: ( 3 * ($column + $gutter) - $gutter) / $em; $cols4: ( 4 * ($column + $gutter) - $gutter) / $em; $cols5: ( 5 * ($column + $gutter) - $gutter) / $em; $cols6: ( 6 * ($column + $gutter) - $gutter) / $em; $cols7: ( 7 * ($column + $gutter) - $gutter) / $em; $cols8: ( 8 * ($column + $gutter) - $gutter) / $em; $cols9: ( 9 * ($column + $gutter) - $gutter) / $em; $cols10: (10 * ($column + $gutter) - $gutter) / $em; $cols11: (11 * ($column + $gutter) - $gutter) / $em; $cols12: (12 * ($column + $gutter) - $gutter) / $em; $cols13: (13 * ($column + $gutter) - $gutter) / $em; $cols14: (14 * ($column + $gutter) - $gutter) / $em; $cols15: (15 * ($column + $gutter) - $gutter) / $em; $cols16: (16 * ($column + $gutter) - $gutter) / $em; .hello_world{ width: $column }
The command
sass grid.scss grid.css
produces:.hello_world { width: 48px; }
相关问答
更多-
要编译文件夹中的所有文件,您可以执行以下操作: sass: { dist: { files: [ { expand: true, // Recursive cwd: "WebContent/source/sass", // The startup directory src: ["**/*.scss"], // Source files dest: "Webconten ...
-
SASS编译空CSS文件?(SASS compiles empty CSS file?)[2023-07-31]
正如@pjumble评论所述,您只是定义变量。 获取代码并添加额外的hello_world语句: $font-size: 16px; $em: $font-size / 1em; $column: 48px; $gutter: 24px; $cols1: ( 1 * ($column + $gutter) - $gutter) / $em; $cols2: ( 2 * ($column + $gutter) - $gutter) / $em; $cols3: ( 3 * ($column + $g ... -
您需要将_test.scss更改为test.scss 。 Node sass忽略_filenames 。 通常我们使用_与要在scss文件中导入的文件名。 You need to change _test.scss to test.scss. Node sass ignores _filenames. Usually we use _ with files names which are going to be imported in the scss files.
-
一定是个错字。 您的文件应该是style.scss ,而不是style.sccs 。 It must be a typo. Your file should be style.scss, not style.sccs.
-
我按照建议交换了gulp-sass。 我的代码: var gulp = require('gulp'), sass = require('gulp-sass') notify = require("gulp-notify") bower = require('gulp-bower'); var config = { sassPath: './scss', bowerDir: './bower_components' } gulp.task('css ...
-
您不应该使用webpack来构建第三方scss文件。 它们应该已经被转换为css并且可供您用作导入。 可能是问题的原因。 此外,如果您使用的是webpack 2,那么您的规则结构错误。 来自webpack 2 docs https://webpack.js.org/loaders/sass-loader/#components/sidebar/sidebar.jsx : module: { rules: [{ test: /\.scss$/, ...
-
如何在没有编译css in react的情况下观看sass文件夹的更改(How to watch sass folder for changes without compiling in css in react)[2022-03-10]
为简单起见,CRA抽象出构建配置逻辑。 如果要添加自定义构建逻辑,则需要使用以下命令选择退出抽象版本: npm run eject 这将运行一个脚本来公开webpack构建配置。 从那里,你需要为webpack添加一个sass加载器。 指南: https : //medium.com/@Connorelsea/using-sass-with-create-react-app-7125d6913760 CRA abstracts away the build configuration logic for s ... -
在所有的网络上花了几个小时,我终于发现了有罪的:Froala宝石 通过查看插件的来源和预编译资产列表,他们有一个名为“plugins”的文件夹,其名称与个人文件夹相同。 这意味着我的插件文件夹与sass部分也被编译! 修复它的方法是重命名我自己的'插件'文件夹。 After spending hours and hours on all the web, I finally discovered the guilty: Froala gem By looking to the source of the p ...
-
您需要更改config.rb中的css_dir = "stylesheet"以指向您希望编译的CSS文件的位置。 在你的情况下,听起来你想要它在这里: css_dir = "./" 您可能还需要启用相对URL。 Ok i have sorted it out the issue, i start from the beginning calling the project differently ( without any hyphen) then i set up the output folder b ...
-
sass-loader固定。 关键是css-loader的add modules = true ,然后您可以从scss文件导入样式。 { test: /\.scss$/, loader: extractCSS.extract('style', 'css?modules=true!sass?sourceMap=true') } public / style / main.css已修复。 说实话,我不确定有什么不同,但现在填充了public ...