Mercurial > urweb
comparison src/c/urweb.c @ 1349:87156c44824f
Periodic tasks
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 18 Dec 2010 15:17:09 -0500 |
parents | b106ca8200b1 |
children | 703c2c94afd5 |
comparison
equal
deleted
inserted
replaced
1348:8a169fc0838b | 1349:87156c44824f |
---|---|
3490 if (ctx->hasPostBody) | 3490 if (ctx->hasPostBody) |
3491 return ctx->postBody; | 3491 return ctx->postBody; |
3492 else | 3492 else |
3493 uw_error(ctx, FATAL, "Asked for POST body when none exists"); | 3493 uw_error(ctx, FATAL, "Asked for POST body when none exists"); |
3494 } | 3494 } |
3495 | |
3496 failure_kind uw_runCallback(uw_context ctx, void (*callback)(uw_context)) { | |
3497 int r = setjmp(ctx->jmp_buf); | |
3498 | |
3499 if (ctx->app->db_begin(ctx)) | |
3500 uw_error(ctx, BOUNDED_RETRY, "Error running SQL BEGIN"); | |
3501 | |
3502 if (r == 0) { | |
3503 callback(ctx); | |
3504 uw_commit(ctx); | |
3505 } | |
3506 else | |
3507 uw_rollback(ctx, 0); | |
3508 | |
3509 return r; | |
3510 } |