Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

test_wakeup.c File Reference

#include <unistd.h>
#include "gwlib/gwlib.h"

Include dependency graph for test_wakeup.c:

Include dependency graph

Go to the source code of this file.

Functions

void thread1 (void *arg)
void thread2 (void *arg)
int main (void)


Function Documentation

int main void   ) 
 

Definition at line 85 of file test_wakeup.c.

References debug(), gwlib_init(), gwlib_shutdown(), gwthread_cancel(), gwthread_create, gwthread_join_all(), gwthread_wakeup(), gwthread_wakeup_all(), thread1(), and thread2().

00086 {
00087     pid_t pid;
00088     long t1, t2;
00089     int ret;
00090     
00091     gwlib_init();
00092     pid = getpid();
00093     debug("test", 0, "Parent pid %ld", (long)pid);
00094     t1 = gwthread_create(thread1, NULL);
00095     t2 = gwthread_create(thread2, NULL);
00096     sleep(1);
00097     gwthread_wakeup(t1);
00098     ret = gwthread_cancel(t2);
00099     debug("test", 0 ,"gwthread_cancel returns: %d", ret);
00100     gwthread_wakeup_all();
00101     gwthread_join_all();
00102     gwlib_shutdown();
00103     return 0;
00104 }

Here is the call graph for this function:

void thread1 void *  arg  )  [static]
 

Definition at line 61 of file test_wakeup.c.

References debug(), and gwthread_sleep().

Referenced by main().

00062 {
00063     pid_t pid;
00064 
00065     debug("test", 0, "Sleeping");
00066     pid = getpid();
00067     debug("test", 0, "Thread1 pid %ld", (long)pid);
00068 
00069     gwthread_sleep(600);
00070     debug("test", 0, "Woke up");
00071 }

Here is the call graph for this function:

void thread2 void *  arg  )  [static]
 

Definition at line 73 of file test_wakeup.c.

References debug(), and gwthread_sleep().

Referenced by main().

00074 {
00075     pid_t pid;
00076 
00077     debug("test", 0, "Sleeping");
00078     pid = getpid();
00079     debug("test", 0, "Thread2 pid %ld", (long)pid);
00080 
00081     gwthread_sleep(600);
00082     debug("test", 0, "Woke up");
00083 }

Here is the call graph for this function:

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.