Skip to content

Commit

Permalink
* Made lambdas to be stored on the stack again on windows
Browse files Browse the repository at this point in the history
* Fixed a type within execution.cpp
* Mark memory leak bug as fixed

git-svn-id: http://opensource.mlba-team.de/svn/xdispatch/trunk@163 9e4c620c-c391-4b63-a7fb-4924991ea895
  • Loading branch information
marius committed May 30, 2011
1 parent b7338b9 commit 11df150
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
8 changes: 1 addition & 7 deletions BUGS
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,4 @@
fast again
* periodic timers have an increasing delay the longer they run
(see dispatch_drift test). This might be due to an implementation
error of EVT_FILT_TIMER on windows.
* Due to an implementation bug in gcc 4.5.1 regarding the destruction
of lambdas, all variables used from within a block but created
in the outer scope will not get properly deleted as the lambdas
will never be freed. Issue seems to be nonexistend when using
clang and can easily eradicated within VS 2010 when creating
lambdas on the heap instead of the stack by using an explicit new.
error of EVT_FILT_TIMER on windows.
8 changes: 4 additions & 4 deletions cxx/execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ void xdispatch::run_operation(void* dt){
try {
(*w)();
} catch(const std::exception& e) {
std::cerr << "Note: Throwing execptions within an xdispatch::operation is not supported, please make sure to catch them before: " << e.what() << std::endl;
std::cerr << "Note: Throwing exceptions within an xdispatch::operation is not supported, please make sure to catch them before: " << e.what() << std::endl;
} catch(...) {
std::cerr << "Note: Throwing execptions within an xdispatch::operation is not supported, please make sure to catch them before!" << std::endl;
std::cerr << "Note: Throwing exceptions within an xdispatch::operation is not supported, please make sure to catch them before!" << std::endl;
}

if(w->auto_delete())
Expand All @@ -50,9 +50,9 @@ void xdispatch::run_iter_wrap(void* dt, size_t index){
try {
wrap->run(index);
} catch(const std::exception& e) {
std::cerr << "Note: Throwing execptions within an xdispatch::operation is not supported, please make sure to catch them before: " << e.what() << std::endl;
std::cerr << "Note: Throwing exceptions within an xdispatch::operation is not supported, please make sure to catch them before: " << e.what() << std::endl;
} catch(...) {
std::cerr << "Note: Throwing execptions within an xdispatch::operation is not supported, please make sure to catch them before!" << std::endl;
std::cerr << "Note: Throwing exceptions within an xdispatch::operation is not supported, please make sure to catch them before!" << std::endl;
}

if(wrap->deref())
Expand Down
12 changes: 6 additions & 6 deletions include/xdispatch/lambda_blocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@
# ifndef XDISPATCH_NO_KEYWORDS
# define $ [=]
# endif
# define XDISPATCH_BLOCK_PERSIST(A) new auto(A)
# define XDISPATCH_BLOCK_COPY(A) new auto(*(A))
# define XDISPATCH_BLOCK_DELETE(A) delete A
# define XDISPATCH_BLOCK_EXEC(A) (*A)
# define XDISPATCH_BLOCK_PERSIST(A) (A)
# define XDISPATCH_BLOCK_COPY(A) (A)
# define XDISPATCH_BLOCK_DELETE(A) {}
# define XDISPATCH_BLOCK_EXEC(A) (A)
typedef const std::tr1::function< void (void) >& dispatch_block_t;
typedef const std::tr1::function< void (size_t) >& dispatch_iteration_block_t;
typedef std::tr1::function< void (void) >* dispatch_block_store;
typedef std::tr1::function< void (size_t) >* dispatch_iteration_block_store;
typedef std::tr1::function< void (void) > dispatch_block_store;
typedef std::tr1::function< void (size_t) > dispatch_iteration_block_store;
# define XDISPATCH_HAS_BLOCKS

// gcc 4.5 with c++0x enabled
Expand Down

0 comments on commit 11df150

Please sign in to comment.