Skip to content

Commit 742eea6

Browse files
committed
modify stateful goroutines example
1 parent f925116 commit 742eea6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

examples/Stateful-Goroutines.ipynb

+11-2
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@
250250
" atomic.AddInt64(&ops, 1)\n",
251251
" }\n",
252252
" }()\n",
253-
"}"
253+
"}\n",
254+
"// let the goroutines work for a second\n",
255+
"time.Sleep(time.Second)"
254256
]
255257
},
256258
{
@@ -277,7 +279,7 @@
277279
{
278280
"data": {
279281
"text/plain": [
280-
"\u001b[34m\u001b[1m46\u001b[0m\n"
282+
"\u001b[34m\u001b[1m892297\u001b[0m\n"
281283
]
282284
},
283285
"execution_count": 12,
@@ -288,6 +290,13 @@
288290
"source": [
289291
"opsFinal := atomic.LoadInt64(&ops)"
290292
]
293+
},
294+
{
295+
"cell_type": "markdown",
296+
"metadata": {},
297+
"source": [
298+
"Running our program shows that the goroutine-based state management example achieves about 800,000 operations per second."
299+
]
291300
}
292301
],
293302
"metadata": {

0 commit comments

Comments
 (0)