1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00
This commit is contained in:
dan
2001-02-09 03:20:54 +00:00
parent a1fb870fe8
commit 40386e1d40

View File

@@ -17,13 +17,16 @@ it), there are some ways to handle it:
This is by far the best method, since it will assure you that if you This is by far the best method, since it will assure you that if you
enqueue more than one notification to remove the same connection, they will enqueue more than one notification to remove the same connection, they will
be coalesced, and called only once. be coalesced, and called only once.
2. In your observer, put the died/closed connection in a bag, and destroy all
the connections present in the bag, in your main loop, after you call the 2. In your observer, put the died/closed connection in an array or bag, and
WHandleEvents()/WMHandleEvent(). Also closing the connection can be done destroy all the connections present in the array/bag, in your main loop,
before putting the connection in the bag, but is optional as noted above. after you call the WHandleEvents()/WMHandleEvent(). Also closing the
In this case you need to make sure you don't put in the bag the same connection can be done before putting the connection in the array/bag, but
connection more than once, in case the DieNotification is sent more that is optional as noted above. In this case you need to make sure you don't
once to you. This is automagically solved by method 1. put in the array/bag the same connection more than once, in case the
DieNotification is sent more that once to you. This is automagically solved
by method 1.
3. In case it's your only connection, and you plan to exit if it was closed or 3. In case it's your only connection, and you plan to exit if it was closed or
died, then you can safely close/remove it, and exit. As long as you no died, then you can safely close/remove it, and exit. As long as you no
longer access it, there is no problem. longer access it, there is no problem.
@@ -33,10 +36,11 @@ it), there are some ways to handle it:
means until your code gets back to the main loop). This is almost always means until your code gets back to the main loop). This is almost always
very hard to achive and subject to hidden errors. I do not recommend this very hard to achive and subject to hidden errors. I do not recommend this
way of handling the died notification. It is ugly and very complicated to way of handling the died notification. It is ugly and very complicated to
handle. If you use it and get plenty of SIGSEGVs then you know why. handle if the program is in a very deeply nested function when it finds out
This method was not presented here to be used, but to show what should that the connection died. If you use it and get plenty of SIGSEGVs then you
be avoided in dealing with the died notification, in case someone gets the know why. This method was not presented here to be used, but to show what
idea to try it this way. should be avoided in dealing with the died notification, in case someone
gets the idea to try it this way.
Note: read/write operations means to use our read/write functions (like Note: read/write operations means to use our read/write functions (like