source: CIVL/examples/pthread/bigshot_p_false.cvl@ 50f834b

1.23 2.0 main test-branch
Last change on this file since 50f834b was f72f577, checked in by John Edenhofner <johneden@…>, 12 years ago

Added support for robust mutex, get/sets for pthread_mutexattr_t fields, pthread_mutex_trylock, and multiple new competition code examples

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@1073 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 557 bytes
Line 
1#include <stdlib.h>
2#include <civlc.h>
3#include "pthread.cvh"
4#include <string.h>
5
6void __VERIFIER_assert(int expression) { if (!expression) { ERROR: goto ERROR; }; return; }
7
8char *v;
9
10void *thread1(void * arg)
11{
12 v = malloc(sizeof(char) * 8);
13}
14
15void *thread2(void *arg)
16{
17 if (v) strcpy(v, "Bigshot");
18}
19
20
21int main(void)
22{
23 pthread_t t1, t2;
24
25 pthread_create(&t1, 0, thread1, 0);
26 pthread_create(&t2, 0, thread2, 0);
27 pthread_join(t1, 0);
28 pthread_join(t2, 0);
29
30 __VERIFIER_assert(!v || v[0] == 'B');
31
32 return 0;
33}
Note: See TracBrowser for help on using the repository browser.