Replacement for Win32 events



  • 1. Comparing files using "C" code
    I have a requirement to compare binrary or text based files and I am looking for some very very effient "C" code, which I can call from my application. Can anybody provide me with some examples or point me to a place where I can find some open source for the "cmp" utility or something very similiar. Thanks in advance for all that answer this post.
  • 2. Finding the callstack programmatically
    Hi, Is there a way to find the call stack at any point of time inside a (C/C++) program? Whenever my program raises a SIGSEGV, is it possible for me to print the function call stack in the SIGSEGV handler? Thanks. Ashutosh
  • 3. measureing host loads every 10 sec until an application is finished.
    Hi, I want to measure host loads (using system(uptime)) every 10 seconds while I am running an application which is written in C, and write the host load average during the application execution to a file right after the application terminates. i.e., --- Application is started --- measure load average (using `uptime`) every 10 seconds during the execution --- Application is finished. --- calculate the load average and print it out My question is how I can run system(uptime) every 10 seconds during the application execution using one processor machine? I was thinking of having two threads, but the thread blocks the other until it is terminated which is not what I want. I need to run two jobs (uptime every 10 seconds and an application executable) simultaneously and measureing uptime should be finished when the application is finished. any suggestions? thanks for any help in advance
  • 4. how to write to a file without race condition
    how to make a parent and all its children write to a file without race condition and data inconsistency

Replacement for Win32 events

Postby John Eskie » Thu, 31 Jul 2003 23:03:11 GMT


Beeing a Windows programmer I got very little experience with the unix api.
From what I understood pthreads are needed for multithreaded programming. I
looked at the pthread api and got the following question.

I got a list of threads in my existing windows prog and during shutdown I
got a event which will be signalled to specify the threads should be shut

It looks like this (only a sample of how it looks):

void ThreadFunc()
while (1)
if (waitforsingleobject(event, <return immediately>) == success) // If we
got a event then we quit the loop and shut the thread

for (i = 0; i < all threads; i++)
    setevent(threadlist[i].event); // signal that we want to quit the thread

for (i = 0; i < all threads; i++)
    if (waitforsingleobject(threadlist[i].event, <max. 500 millisecond
delay>) == success) // if thread didn't shutdown we wait max. 500 msec and
force it to be killed.

I assume I need to use some of those semaphore functions but I am not sure.
I checked out some code which had both win32 and unix code in same code base
but it didn't handle delaying like the 500 millisecond I did.

Thanks in advance.

-- John

Similar Threads:

1.[News] Guide to Linux Replacements for Win32 Software Gradually Improved does sleep waiting on an event and triggering that event work in linux


I'm new to linux and would like to know how I can create and sleep on
event in one kernel thread and have this event trigerred in another
kernel thread...


3.Only One Tkinter Entry can receive key event event in Linux RH8.0

  my program runs well in windows,i use tkSimpleDialog to receive some
input,but when i copy my program into Linux RH8.0,entrys in my
tkSimpleDialog derived Dialog have a vital problem:only one entry can
receive key event,'tab' key to navigate between entrys is not valid
too,when i use mouse to focus a entry(which can not navigate through
'tag' key),no matter what key i pressed the entry receive no reply.But
in window they are all works well.
  even the simplest python program like follow have the seem manner.
from Tkinter import *
  in above program only the second entry can receive key event.(but
when i type program in Python environment it works well)
  I must say there is no fault the first time i run above program
after i install ActivePython2.2 in my Linux.Both entry can receive key
event.but after i do the following operations the problem occur.
  1.install Pmw,i copy Pmw source code from windows
python/lib/site-pages/Pmw directory
  2.install Pil,copy windows source too
  3.change's encoding to 'u8' in order to support chinese
text. my program and the problem occur
  5.change's encoding back to 'ascii' the problem remain
  6.rpm -e ActivePython then delete All Pmw and Pil source code
,reinstall ActivePython ,nothing changed
  i must say i am a newhand in both python and linux,mybe there is
fault in my operations.Maybe i install some packages in a wrong way.
  I think in linux,many people use ActivePython,Pmw,Pil and Tkinter,so
i hope someone may have faced the same problem and can give me some

Best Regard

4.[News] 2 New Events Events Over GNU/Linux

5.[News] Florida Event and Australia Event Cover GNU/Linux

6. [News] More Linux Events and Free Software Events Coming

7. how does sleep waiting on an event and triggering that event work in linux

8. [RFC][PATCH 2/3] Process events biarch bug: Process events timestamp bug

Return to unix


Who is online

Users browsing this forum: No registered users and 58 guest