[omniORB] Threading problem on Win32

Robert Hanson robert.hanson at spanlink.com
Fri Jan 27 13:14:12 GMT 2006


Wrote this simple program to test omnithreads on Linux and win32 (xp);
it works just fine under linux; but the worker thread never exits the
wait call on win32.  

 

Can anyone see what I might be missing?

 

#include <stdio.h>       /* standard I/O routines                     */

#include <stdlib.h>      /* rand() and srand() functions              */

#include <omnithread.h>

 

omni_mutex mutex;

omni_condition condition(&mutex);

 

void* handle_requests_loop(void* data)

{

    int thread_id = *((int*)data);  /* thread identifying number
*/

    printf("Starting thread '%d'\n", thread_id);

    fflush(stdout);

 

      printf("wait %d\n",thread_id);

      fflush(stdout);

      condition.wait();

      printf("thread executing after wait %d\n",thread_id);

      return(NULL);

 }

 

int

main(int argc, char* argv[])

{

    omni_thread *p_thread;

      int id=1;

 

      p_thread =
omni_thread::create(handle_requests_loop,(void*)&id,omni_thread::PRIORIT
Y_NORMAL);

      printf("sleep before signal\n");

      fflush(stdout);

      omni_thread::sleep(1,10);

      // ensure that the thread has performed the wait

      condition.signal();

      printf("done with signal\n");

      fflush(stdout);

      omni_thread::sleep(1,10);

      printf("exit\n");

      fflush(stdout);

}

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20060127/5b32f47b/attachment.htm


More information about the omniORB-list mailing list