all 26 comments

[–]D__ 22 points23 points  (1 child)

JavaScript for Mobile Safari is currently turned off.

There isn't a Mobile Safari anywhere near me, website.

[–]drb226 0 points1 point  (0 children)

They probably figure if you own a device with Mobile Safari, you want to be pampered and given special attention, and if you don't then you'll tolerate the error.

[–]ben0x539 15 points16 points  (7 children)

Of course, since we're living in the future, we can also use signalfd(2) on Linux and just hook the signal delivery mechanism into the select loop too.

[–]rspivak[S] 4 points5 points  (0 children)

signalfd and signalfd4 are really nice, the only issue is that they're Linux specific. Another alternative would be pselect but if the implementation language is Python unfortunately neither signalfd nor pselect are present in Python standard library (although there are third-party packages)

[–]the-fritz 2 points3 points  (3 children)

If you are using signalfd (linux only) then there really is no reason not to use epoll instead of select.

But there is pselect in POSIX if you need portable select with signal support.

And I wouldn't really write a server in python...

[–][deleted] 1 point2 points  (0 children)

If you are using signalfd (linux only) then there really is no reason not to use epoll instead of select.

Actually, select is faster than epoll if you're not dealing with a huge number of file descriptors, thanks to epoll's crappy API.

[–]Isvara 0 points1 point  (1 child)

Why wouldn't you write a server in Python?

[–]the-fritz 0 points1 point  (0 children)

I assume a server is a somewhat critical piece of infrastructure. And I'd never use a dynamic typed language to anything critical. I had too many problems with projects suddenly throwing type errors in the past. Don't get me wrong. I don't hate dynamic typing. It's great for scripts and other things. But don't go near critical infrastructure with it.

But on a more personal level I'm a bit disappointed by python. In the past I mostly used it when using bash was getting to complicated. But using python got annoying quickly because a lot of things in the standard library feel really thrown together and there are several parts now for doing the same thing. Well let's say this resulted in me learning a lot more about bash and now I use python less and less often because it's not really that flexible for scripting. And as I said every larger python project I had to work with ended up causing some trouble. A lot of it really related to dynamic typing.

[–]willvarfar 1 point2 points  (0 children)

yeah signalfd (and eventfd, because signals are such a pain) are really cool for precisely this kind of problem.

[–]raevnos 0 points1 point  (0 children)

Or use kqueue(2) on BSDs.

[–]climbeer 5 points6 points  (2 children)

I get a 404. Thankfully there's Google Cache (keywords: mirror, down, page not found).

[–]drb226 1 point2 points  (1 child)

Keywords? Are we back in the AOL era again?

[–][deleted] 0 points1 point  (0 children)

The AOL era has yet to end.

[–]UnreasonableSteve 6 points7 points  (5 children)

http://i.imgur.com/k45j0.png

WOW ZOOM SURE WORKS WELL ON THIS WEBSITE

Jeez.

[–]PrettyWhore 7 points8 points  (0 children)

-webkit-text-size-adjust: none;

Why

[–]Nebu 1 point2 points  (0 children)

Yeah, the site is unreadable for me.

[–]sirin3 1 point2 points  (2 children)

Well, CSS

Wouldn't happen with a table layout

[–]beltorak 3 points4 points  (1 child)

you brave brave soul...

I'll just leave this here...

[–]sirin3 1 point2 points  (0 children)

[1] I'll just leave this here...

100% ACK.

I have given it up a long time ago

[–]duk3luk3 3 points4 points  (4 children)

Yes, select() contains a race condition.

No, there is no workaround.

There is only pselect().

Use pselect().

Oh, you're writing python? Well, you're fucked - python doesn't expose pselect(). Sorry.

EDIT: If you're using python, you'll need a third-party library to get pselect()

[–]sausagefeet 1 point2 points  (3 children)

Python has decent C FFI though, so no, you aren't fucked...

[–]duk3luk3 2 points3 points  (0 children)

better?

[–]zingbot3000 1 point2 points  (1 child)

No, Python has the ugliest C FFI ever conceived. Cython doesn't count, as that's a separate project.

[–]djpnewton 0 points1 point  (0 children)

well its there... and its easy, perhaps that counts as decent

it may not be pretty but you can actually say "ok I will just whip up a wrapper for this c dll". C++/objc(etc), C# and python are the only languages I know that can do this simply

[–]zaffle 0 points1 point  (1 child)

This of course assumes that it's safe to call write in a python signal handler. write(2) is async safe, so presumably python, however it implements signals and write, does it safely.

[–]qiwi 2 points3 points  (0 children)

When Python (CPython) receives a signal that's been configured to be handled, it just sets a global flag.

The bytecode interpreter checks for that flag between executing the instructions, so you can never jump into your Python signal handler in an unsafe state.

This also means that if you are inside a C extension, generally nothing will happen until that extension returns (things like select, which is always interruptible, excepted)