Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1135)

Unified Diff: samples/todomvc/todomvc_shared.cc

Issue 2035023003: Remove service-compiler related code. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/todomvc/todomvc_shared.h ('k') | samples/todomvc/unix_ia32_hack.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/todomvc/todomvc_shared.cc
diff --git a/samples/todomvc/todomvc_shared.cc b/samples/todomvc/todomvc_shared.cc
deleted file mode 100644
index 61ddde5681dd295afa0d78926dfeb2bf024c0ad9..0000000000000000000000000000000000000000
--- a/samples/todomvc/todomvc_shared.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE.md file.
-
-#include "todomvc_shared.h" // NOLINT(build/include)
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "include/dartino_api.h"
-#include "include/service_api.h"
-
-static const int kDone = 1;
-
-static pthread_mutex_t mutex;
-static pthread_cond_t cond;
-static int status = 0;
-
-static void ChangeStatusAndNotify(int new_status) {
- pthread_mutex_lock(&mutex);
- status = new_status;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&mutex);
-}
-
-static void WaitForStatus(int expected) {
- pthread_mutex_lock(&mutex);
- while (expected != status) pthread_cond_wait(&cond, &mutex);
- pthread_mutex_unlock(&mutex);
-}
-
-static void* DartThreadEntry(void* arg) {
- const char* path = static_cast<char*>(arg);
- DartinoSetup();
- DartinoProgram program = DartinoLoadSnapshotFromFile(path);
- if (DartinoRunMain(program, 0, NULL) != 0) {
- printf("Failed to run snapshot: %s\n", path);
- exit(1);
- }
- DartinoDeleteProgram(program);
- DartinoTearDown();
- ChangeStatusAndNotify(kDone);
- return NULL;
-}
-
-static void RunSnapshotInNewThread(char* path) {
- pthread_t thread;
- int result = pthread_create(&thread, NULL, DartThreadEntry, path);
- if (result != 0) {
- perror("Failed to start thread");
- exit(1);
- }
-}
-
-void SetupTodoMVC(int argc, char** argv) {
- pthread_mutex_init(&mutex, NULL);
- pthread_cond_init(&cond, NULL);
- ServiceApiSetup();
- RunSnapshotInNewThread(argv[1]);
-}
-
-void TearDownTodoMVC() {
- WaitForStatus(kDone);
- ServiceApiTearDown();
-}
« no previous file with comments | « samples/todomvc/todomvc_shared.h ('k') | samples/todomvc/unix_ia32_hack.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698