Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Question

Name: Anonymous 2014-11-15 23:21

If you wanted to create a file within a signal handler in POSIX, how would you do it?

Name: Anonymous 2014-11-15 23:36

first

Name: Anonymous 2014-11-15 23:41

>>2
Noice first. Congrats!

Name: Anonymous 2014-11-16 0:37

>>1
by calling open

Name: Anonymous 2014-11-16 0:38

>>4
Who cares? We're talking about >>2's first, here.

Name: Anonymous 2014-11-16 0:48

It is not that shit of a question.
Signals suck, make a global volatile atomic_t thing shit and use it as a flag, in your main loop if you see this flag set open a file. In your signal handler you just set this flag to true.

Name: >>6 2014-11-16 1:00

Nevermind, I knew about this list but I though that >>1 had checked it first.
http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html

Name: Anonymous 2014-11-16 2:26

>>7
close()
...
creat()
...
open()
...
read()
...
unlink()
...
write()

So you can basically do everything with files that you can do outside of a sgnal handler. Neat.

Name: Anonymous 2014-11-16 4:39

winblows and huskel is better xD

>using a language and operating system from the 40s
>year of our lord

Name: Anonymous 2014-11-17 2:21

>>8
In practice I would expect actually trying to do useful things in a signal handler to be quite bothersome. The available mechanisms for achieving mutual exclusion are crude, and god only knows what weird bugs you're begging to find (in particular, I would not bet my time on the Linux or glibc people giving a flying fuck about little used POSIX features).

Name: Anonymous 2014-11-17 2:32

>>10
Who ever said Linux was POSIX?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List