Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78151 - trunk/libs/context/example
From: oliver.kowalke_at_[hidden]
Date: 2012-04-23 03:23:27


Author: olli
Date: 2012-04-23 03:23:26 EDT (Mon, 23 Apr 2012)
New Revision: 78151
URL: http://svn.boost.org/trac/boost/changeset/78151

Log:
context: example link.cpp removed; example exit.cpp added

Added:
   trunk/libs/context/example/exit.cpp (contents, props changed)
Removed:
   trunk/libs/context/example/link.cpp
Text files modified:
   trunk/libs/context/example/Jamfile.v2 | 4 ++--
   1 files changed, 2 insertions(+), 2 deletions(-)

Modified: trunk/libs/context/example/Jamfile.v2
==============================================================================
--- trunk/libs/context/example/Jamfile.v2 (original)
+++ trunk/libs/context/example/Jamfile.v2 2012-04-23 03:23:26 EDT (Mon, 23 Apr 2012)
@@ -40,8 +40,8 @@
                 : jump.cpp
                 ;
 
-exe link
- : link.cpp
+exe exit
+ : exit.cpp
                 ;
 
 exe transfer

Added: trunk/libs/context/example/exit.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/context/example/exit.cpp 2012-04-23 03:23:26 EDT (Mon, 23 Apr 2012)
@@ -0,0 +1,57 @@
+
+// Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <cstdlib>
+#include <cstring>
+#include <iostream>
+#include <vector>
+
+#include <boost/assert.hpp>
+#include <boost/context/all.hpp>
+
+namespace ctx = boost::ctx;
+
+ctx::fcontext_t fc1, fc2;
+
+void f1( intptr_t)
+{
+ std::cout << "f1: entered" << std::endl;
+ std::cout << "f1: call jump_fcontext( & fc1, & fc2, 0)" << std::endl;
+ ctx::jump_fcontext( & fc1, & fc2, 0);
+ std::cout << "f1: return" << std::endl;
+}
+
+void f2( intptr_t)
+{
+ std::cout << "f2: entered" << std::endl;
+ std::cout << "f2: call jump_fcontext( & fc2, & fc1, 0)" << std::endl;
+ ctx::jump_fcontext( & fc2, & fc1, 0);
+ BOOST_ASSERT( false && ! "f2: never returns");
+}
+
+int main( int argc, char * argv[])
+{
+ ctx::fcontext_t fcm;
+ ctx::stack_allocator alloc;
+
+ fc1.fc_stack.base = alloc.allocate(ctx::minimum_stacksize());
+ fc1.fc_stack.limit =
+ static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
+ ctx::make_fcontext( & fc1, f1);
+
+ fc2.fc_stack.base = alloc.allocate(ctx::minimum_stacksize());
+ fc2.fc_stack.limit =
+ static_cast< char * >( fc2.fc_stack.base) - ctx::minimum_stacksize();
+ ctx::make_fcontext( & fc2, f2);
+
+ std::cout << "main: call start_fcontext( & fcm, & fc1, 0)" << std::endl;
+ ctx::jump_fcontext( & fcm, & fc1, 0);
+
+ std::cout << "main: done" << std::endl;
+ BOOST_ASSERT( false && ! "main: never returns");
+
+ return EXIT_SUCCESS;
+}

Deleted: trunk/libs/context/example/link.cpp
==============================================================================
--- trunk/libs/context/example/link.cpp 2012-04-23 03:23:26 EDT (Mon, 23 Apr 2012)
+++ (empty file)
@@ -1,56 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include <cstdlib>
-#include <cstring>
-#include <iostream>
-#include <vector>
-
-#include <boost/assert.hpp>
-#include <boost/context/all.hpp>
-
-namespace ctx = boost::ctx;
-
-ctx::fcontext_t fc1, fc2;
-
-void f1( intptr_t)
-{
- std::cout << "f1: entered" << std::endl;
- std::cout << "f1: call jump_fcontext( & fc1, & fc2, 0)" << std::endl;
- ctx::jump_fcontext( & fc1, & fc2, 0);
- std::cout << "f1: return" << std::endl;
-}
-
-void f2( intptr_t)
-{
- std::cout << "f2: entered" << std::endl;
- std::cout << "f2: call jump_fcontext( & fc2, & fc1, 0)" << std::endl;
- ctx::jump_fcontext( & fc2, & fc1, 0);
- BOOST_ASSERT( false && ! "f2: never returns");
-}
-
-int main( int argc, char * argv[])
-{
- ctx::fcontext_t fcm;
- ctx::stack_allocator alloc;
-
- fc1.fc_stack.base = alloc.allocate(ctx::minimum_stacksize());
- fc1.fc_stack.limit =
- static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc1, f1);
-
- fc2.fc_stack.base = alloc.allocate(ctx::minimum_stacksize());
- fc2.fc_stack.limit =
- static_cast< char * >( fc2.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc2, f2);
-
- std::cout << "main: call start_fcontext( & fcm, & fc1, 0)" << std::endl;
- ctx::jump_fcontext( & fcm, & fc1, 0);
-
- std::cout << "main: done" << std::endl;
-
- return EXIT_SUCCESS;
-}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk